mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
b5ca87bc31
|
|
@ -8,6 +8,7 @@ English Dolibarr ChangeLog
|
|||
For users:
|
||||
----------
|
||||
NEW: Compatibility with PHP 8.2 (with no need to disable warnings)
|
||||
NEW: Font param Look and Feel THEME_FONT_FAMILY
|
||||
...
|
||||
|
||||
For developers or integrators:
|
||||
|
|
|
|||
|
|
@ -619,6 +619,7 @@ $html .= '</div>';
|
|||
$html .= '</div>';
|
||||
|
||||
// OSSINSIGHT graph
|
||||
/*
|
||||
$html .= <<<END
|
||||
<br>
|
||||
<!-- Copy-paste in your Readme.md file -->
|
||||
|
|
@ -632,6 +633,7 @@ $html .= <<<END
|
|||
|
||||
<!-- Made with [OSS Insight](https://ossinsight.io/) -->
|
||||
END;
|
||||
*/
|
||||
|
||||
$html .= '</section>'."\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ if (!$user->hasRight('accounting', 'bind', 'write')) {
|
|||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$codeventil_buy = GETPOST('codeventil_buy', 'array');
|
||||
|
|
@ -69,7 +70,7 @@ $changeaccount_buy = GETPOST('changeaccount_buy', 'array');
|
|||
'@phan-var-force string[] $changeaccount_buy';
|
||||
$changeaccount_sell = GETPOST('changeaccount_sell', 'array');
|
||||
'@phan-var-force string[] $changeaccount_sell';
|
||||
$searchCategoryProductOperator = (GETPOSTINT('search_category_product_operator') ? GETPOSTINT('search_category_product_operator') : 0);
|
||||
$searchCategoryProductOperator = GETPOSTINT('search_category_product_operator');
|
||||
$searchCategoryProductList = GETPOST('search_category_product_list', 'array');
|
||||
'@phan-var-force string[] $searchCategoryProductList';
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
|
|
@ -515,10 +516,12 @@ if ($resql) {
|
|||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
$massactionbutton = '';
|
||||
|
||||
if ($massaction !== 'set_default_account') {
|
||||
$arrayofmassactions = array(
|
||||
'changeaccount' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Save")
|
||||
,'set_default_account' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
|
||||
'changeaccount' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Save"),
|
||||
'set_default_account' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ConfirmPreselectAccount")
|
||||
);
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -227,7 +228,7 @@ if (empty($reshook)) {
|
|||
$object = new BookKeeping($db);
|
||||
|
||||
$result = $object->fetch($id, null, $mode);
|
||||
$piece_num = $object->piece_num;
|
||||
$piece_num = (int) $object->piece_num;
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
|
@ -284,7 +285,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
$action = '';
|
||||
$id = $object->id;
|
||||
$piece_num = $object->piece_num;
|
||||
$piece_num = (int) $object->piece_num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -438,7 +439,7 @@ if ($action == 'create') {
|
|||
|
||||
$head = array();
|
||||
$h = 0;
|
||||
$head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode ? '&mode='.$mode : '');
|
||||
$head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.((int) $object->piece_num).($mode ? '&mode='.$mode : '');
|
||||
$head[$h][1] = $langs->trans("Transaction");
|
||||
$head[$h][2] = 'transaction';
|
||||
$h++;
|
||||
|
|
@ -467,14 +468,14 @@ if ($action == 'create') {
|
|||
if ($action != 'editdate') {
|
||||
print '<td class="right">';
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&piece_num='.urlencode((string) $object->piece_num).'&mode='.urlencode((string) $mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a>';
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&token='.newToken().'&piece_num='.((int) $object->piece_num).'&mode='.urlencode((string) $mode).'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editdate') {
|
||||
print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?piece_num='.urlencode((string) $object->piece_num).'" method="POST">';
|
||||
print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?piece_num='.((int) $object->piece_num).'" method="POST">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
|
|
@ -498,14 +499,14 @@ if ($action == 'create') {
|
|||
if ($action != 'editjournal') {
|
||||
print '<td class="right">';
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&token='.newToken().'&piece_num='.urlencode((string) $object->piece_num).'&mode='.urlencode((string) $mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&token='.newToken().'&piece_num='.((int) $object->piece_num).'&mode='.urlencode((string) $mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editjournal') {
|
||||
print '<form name="setjournal" action="'.$_SERVER["PHP_SELF"].'?piece_num='.urlencode((string) $object->piece_num).'" method="POST">';
|
||||
print '<form name="setjournal" action="'.$_SERVER["PHP_SELF"].'?piece_num='.((int) $object->piece_num).'" method="POST">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
|
|
@ -529,14 +530,14 @@ if ($action == 'create') {
|
|||
if ($action != 'editdocref') {
|
||||
print '<td class="right">';
|
||||
if ($permissiontoadd) {
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&token='.newToken().'&piece_num='.urlencode((string) $object->piece_num).'&mode='.urlencode((string) $mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&token='.newToken().'&piece_num='.((int) $object->piece_num).'&mode='.urlencode((string) $mode).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editdocref') {
|
||||
print '<form name="setdocref" action="'.$_SERVER["PHP_SELF"].'?piece_num='.urlencode((string) $object->piece_num).'" method="POST">';
|
||||
print '<form name="setdocref" action="'.$_SERVER["PHP_SELF"].'?piece_num='.((int) $object->piece_num).'" method="POST">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
|
|
@ -664,7 +665,7 @@ if ($action == 'create') {
|
|||
// List of movements
|
||||
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.((int) $object->piece_num).'" method="post">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
|
|
@ -787,7 +788,7 @@ if ($action == 'create') {
|
|||
print '<td class="center nowraponall">';
|
||||
if ($permissiontoadd) {
|
||||
if (empty($line->date_export) && empty($line->date_validation)) {
|
||||
print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode((string) $mode) . '&token=' . urlencode(newToken()) . '">';
|
||||
print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . ((int) $line->piece_num) . '&mode=' . urlencode((string) $mode) . '&token=' . urlencode(newToken()) . '">';
|
||||
print img_edit('', 0, 'class="marginrightonly"');
|
||||
print '</a> ';
|
||||
} else {
|
||||
|
|
@ -802,7 +803,7 @@ if ($action == 'create') {
|
|||
$actiontodelete = 'confirm_delete';
|
||||
}
|
||||
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=' . $actiontodelete . '&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode((string) $mode) . '&token=' . urlencode(newToken()) . '">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=' . $actiontodelete . '&id=' . $line->id . '&piece_num=' . ((int) $line->piece_num) . '&mode=' . urlencode((string) $mode) . '&token=' . urlencode(newToken()) . '">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
} else {
|
||||
|
|
@ -830,7 +831,7 @@ if ($action == 'create') {
|
|||
print '<br>';
|
||||
print '<div class="center">';
|
||||
if ($total_debit == $total_credit) {
|
||||
print '<a class="button" href="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||
print '<a class="button" href="'.$_SERVER["PHP_SELF"].'?piece_num='.((int) $object->piece_num).'&action=valid">'.$langs->trans("ValidTransaction").'</a>';
|
||||
} else {
|
||||
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $debit, $credit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1291,6 +1291,7 @@ while ($i < min($num, $limit)) {
|
|||
//$modulepart = 'invoice_supplier';
|
||||
|
||||
if ($objectstatic->id > 0) {
|
||||
$modulepart = 'invoice_supplier';
|
||||
$filename = dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
|
|
|
|||
|
|
@ -1177,8 +1177,8 @@ while ($i < min($num, $limit)) {
|
|||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$objectstatic = new FactureFournisseur($db);
|
||||
$objectstatic->fetch($line->fk_doc);
|
||||
//$modulepart = 'invoice_supplier';
|
||||
|
||||
$modulepart = 'invoice_supplier';
|
||||
$filename = dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
|
|
|
|||
|
|
@ -1174,8 +1174,8 @@ while ($i < min($num, $limit)) {
|
|||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$objectstatic = new FactureFournisseur($db);
|
||||
$objectstatic->fetch($line->fk_doc);
|
||||
//$modulepart = 'invoice_supplier';
|
||||
|
||||
$modulepart = 'invoice_supplier';
|
||||
$filename = dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
|
||||
|
|
|
|||
|
|
@ -3151,6 +3151,9 @@ class BookKeepingLine extends CommonObjectLine
|
|||
public $import_key;
|
||||
public $code_journal;
|
||||
public $journal_label;
|
||||
/**
|
||||
* @var int accounting transaction id
|
||||
*/
|
||||
public $piece_num;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1232,6 +1232,91 @@ class Setup extends DolibarrApi
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Extrafield object
|
||||
*
|
||||
* @param string $attrname extrafield attrname
|
||||
* @param string $elementtype extrafield elementtype
|
||||
* @param array $request_data Request datas
|
||||
* @return int ID of extrafield
|
||||
*
|
||||
* @url PUT extrafields/{elementtype}/{attrname}
|
||||
*
|
||||
* @suppress PhanPluginUnknownArrayMethodParamType Luracast limitation
|
||||
*
|
||||
*/
|
||||
public function updateExtrafields($attrname, $elementtype, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->admin) {
|
||||
throw new RestException(403, 'Only an admin user can create an extrafield');
|
||||
}
|
||||
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
|
||||
$result = $extrafields->fetch_name_optionals_label($elementtype, false, $attrname);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Extrafield not found from attrname and elementtype');
|
||||
}
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
$extrafields->$field = $this->_checkValForAPI($field, $value, $extrafields);
|
||||
}
|
||||
|
||||
// built in validation
|
||||
$enabled = 1; // hardcoded because it seems to always be 1 in every row in the database
|
||||
if ($request_data['entity']) {
|
||||
$entity = $request_data['entity'];
|
||||
} else {
|
||||
throw new RestException(400, "Entity field absent");
|
||||
}
|
||||
if ($request_data['label']) {
|
||||
$label = $request_data['label'];
|
||||
} else {
|
||||
throw new RestException(400, "label field absent");
|
||||
}
|
||||
|
||||
$alwayseditable = $request_data['alwayseditable'];
|
||||
$default_value = $request_data['default_value'];
|
||||
$totalizable = $request_data['totalizable'];
|
||||
$printable = $request_data['printable'];
|
||||
$required = $request_data['required'];
|
||||
$langfile = $request_data['langfile'];
|
||||
$computed = $request_data['computed'];
|
||||
$unique = $request_data['unique'];
|
||||
$param = $request_data['param'];
|
||||
$perms = $request_data['perms'];
|
||||
$size = $request_data['size'];
|
||||
$type = $request_data['type'];
|
||||
$list = $request_data['list'];
|
||||
$help = $request_data['help'];
|
||||
$pos = $request_data['pos'];
|
||||
$moreparams = array();
|
||||
|
||||
dol_syslog(get_class($this).'::updateExtraField', LOG_DEBUG);
|
||||
if ( 0 > $extrafields->updateExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $default_value, $param, $alwayseditable, $perms, $list, $help, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams)) {
|
||||
throw new RestException(500, 'Error updating extrafield', array_merge(array($extrafields->errno), $extrafields->errors));
|
||||
}
|
||||
|
||||
$sql = "SELECT t.rowid as id";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."extrafields as t";
|
||||
$sql .= " WHERE elementtype = '".$this->db->escape($elementtype)."'";
|
||||
$sql .= " AND name = '".$this->db->escape($attrname)."'";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$tab = $this->db->fetch_object($resql);
|
||||
$id = (int) $tab->id;
|
||||
} else {
|
||||
$id = (int) -1;
|
||||
}
|
||||
} else {
|
||||
$id = (int) -2;
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of towns.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -28,7 +29,7 @@
|
|||
abstract class CommonHookActions
|
||||
{
|
||||
/**
|
||||
* @var string String of results.
|
||||
* @var ?string String of results.
|
||||
*/
|
||||
public $resprints;
|
||||
|
||||
|
|
|
|||
|
|
@ -182,6 +182,78 @@ class ExtraFields
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing extra field parameter
|
||||
*
|
||||
* @param string $attrname Code of attribute
|
||||
* @param string $label label of attribute
|
||||
* @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datetime','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...)
|
||||
* @param int $pos Position of attribute
|
||||
* @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma.
|
||||
* @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...)
|
||||
* @param int $unique Is field unique or not
|
||||
* @param int $required Is field required or not
|
||||
* @param string $default_value Defaulted value (In database. use the default_value feature for default value on screen. Example: '', '0', 'null', 'avalue')
|
||||
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param string $list Visibility ('0'=never visible, '1'=visible on list+forms, '2'=list only, '3'=form only or 'eval string')
|
||||
* @param string $help Text with help tooltip
|
||||
* @param string $computed Computed value
|
||||
* @param string $entity Entity of extrafields (for multicompany modules)
|
||||
* @param string $langfile Language file
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @param int $totalizable Is a measure. Must show a total on lists
|
||||
* @param int $printable Is extrafield displayed on PDF
|
||||
* @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...)
|
||||
* @return int Return integer <=0 if KO, >0 if OK
|
||||
*/
|
||||
public function updateExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array())
|
||||
{
|
||||
if (empty($attrname)) {
|
||||
return -1;
|
||||
}
|
||||
if (empty($label)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$result = 0;
|
||||
|
||||
if ($type == 'separator' || $type == 'separate') {
|
||||
$type = 'separate';
|
||||
$unique = 0;
|
||||
$required = 0;
|
||||
} // Force unique and not required if this is a separator field to avoid troubles.
|
||||
if ($elementtype == 'thirdparty') {
|
||||
$elementtype = 'societe';
|
||||
}
|
||||
if ($elementtype == 'contact') {
|
||||
$elementtype = 'socpeople';
|
||||
}
|
||||
|
||||
// Create field into database except for separator type which is not stored in database
|
||||
if ($type != 'separate') {
|
||||
dol_syslog(get_class($this).'::thisupdate', LOG_DEBUG);
|
||||
$result = $this->update($attrname, $label, $type, $size, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams);
|
||||
}
|
||||
$err1 = $this->errno;
|
||||
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') {
|
||||
// Add declaration of field into table
|
||||
dol_syslog(get_class($this).'::thislabel', LOG_DEBUG);
|
||||
$result2 = $this->update_label($attrname, $label, $type, $size, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams);
|
||||
$err2 = $this->errno;
|
||||
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) {
|
||||
$this->error = '';
|
||||
$this->errno = '0';
|
||||
return 1;
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new optional attribute.
|
||||
* This is a private method. For public method, use addExtraField.
|
||||
|
|
@ -418,10 +490,11 @@ class ExtraFields
|
|||
$sql .= " ".($cssview ? "'".$this->db->escape($cssview)."'" : "null");
|
||||
$sql .= ')';
|
||||
|
||||
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
dol_syslog(get_class($this)."::create_label_success", LOG_DEBUG);
|
||||
return 1;
|
||||
} else {
|
||||
dol_syslog(get_class($this)."::create_label_error", LOG_DEBUG);
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errno = $this->db->lasterrno();
|
||||
return -1;
|
||||
|
|
@ -617,19 +690,23 @@ class ExtraFields
|
|||
}
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this).'::DDLUpdateField', LOG_DEBUG);
|
||||
if ($type != 'separate') { // No table update when separate type
|
||||
$result = $this->db->DDLUpdateField($this->db->prefix().$table, $attrname, $field_desc);
|
||||
}
|
||||
if ($result > 0 || $type == 'separate') {
|
||||
if ($label) {
|
||||
dol_syslog(get_class($this).'::update_label', LOG_DEBUG);
|
||||
$result = $this->update_label($attrname, $label, $type, $length, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams);
|
||||
}
|
||||
if ($result > 0) {
|
||||
$sql = '';
|
||||
if ($unique) {
|
||||
$sql = "ALTER TABLE ".$this->db->prefix().$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")";
|
||||
dol_syslog(get_class($this).'::update_unique', LOG_DEBUG);
|
||||
$sql = "ALTER TABLE ".$this->db->prefix().$table." ADD UNIQUE INDEX uk_".$table."_".$this->db->sanitize($attrname)." (".$this->db->sanitize($attrname).")";
|
||||
} else {
|
||||
$sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX IF EXISTS uk_".$table."_".$attrname;
|
||||
dol_syslog(get_class($this).'::update_common', LOG_DEBUG);
|
||||
$sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX IF EXISTS uk_".$table."_".$this->db->sanitize($attrname);
|
||||
}
|
||||
dol_syslog(get_class($this).'::update', LOG_DEBUG);
|
||||
$resql = $this->db->query($sql, 1, 'dml');
|
||||
|
|
@ -654,6 +731,7 @@ class ExtraFields
|
|||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Modify description of personalized attribute
|
||||
* This is a private method. For public method, use updateExtraField.
|
||||
*
|
||||
* @param string $attrname Name of attribute
|
||||
* @param string $label Label of attribute
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
/* Copyright (C) 2010-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -44,28 +45,41 @@ class HookManager
|
|||
*/
|
||||
public $errors = array();
|
||||
|
||||
// Context hookmanager was created for ('thirdpartycard', 'thirdpartydao', ...)
|
||||
/**
|
||||
* @var string[] Context hookmanager was created for ('thirdpartycard', 'thirdpartydao', ...)
|
||||
*/
|
||||
public $contextarray = array();
|
||||
|
||||
// Array with instantiated classes
|
||||
/**
|
||||
* array<string,array<string,null|string|CommonHookActions>> Array with instantiated classes
|
||||
*/
|
||||
public $hooks = array();
|
||||
|
||||
/**
|
||||
* @var array List of hooks called during this request
|
||||
* @var array<string,array{name:string,contexts:string[],file:string,line:string,count:int}> List of hooks called during this request (key = hash)
|
||||
*/
|
||||
public $hooksHistory = [];
|
||||
|
||||
// Array result
|
||||
/**
|
||||
* @var mixed[] Result
|
||||
*/
|
||||
public $resArray = array();
|
||||
// Printable result
|
||||
|
||||
/**
|
||||
* @var string Printable result
|
||||
*/
|
||||
public $resPrint = '';
|
||||
// Nb of qualified hook ran
|
||||
|
||||
/**
|
||||
* @var int Nb of qualified hook ran
|
||||
*/
|
||||
public $resNbOfHooks = 0;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
|
|
@ -82,7 +96,7 @@ class HookManager
|
|||
* Then when a hook executeHooks('aMethod'...) is called, the method aMethod found into class will be executed.
|
||||
*
|
||||
* @param string[] $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ...
|
||||
* @return int 0 or 1
|
||||
* @return int<0,1> 0 or 1
|
||||
*/
|
||||
public function initHooks($arraycontext)
|
||||
{
|
||||
|
|
@ -125,6 +139,7 @@ class HookManager
|
|||
if ($resaction) {
|
||||
$controlclassname = 'Actions'.ucfirst($module);
|
||||
$actionInstance = new $controlclassname($this->db);
|
||||
'@phan-var-force CommonHookActions $actionInstance';
|
||||
$priority = empty($actionInstance->priority) ? 50 : $actionInstance->priority;
|
||||
$this->hooks[$context][$priority.':'.$module] = $actionInstance;
|
||||
}
|
||||
|
|
@ -150,10 +165,10 @@ class HookManager
|
|||
* Execute hooks (if they were initialized) for the given method
|
||||
*
|
||||
* @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...)
|
||||
* @param array $parameters Array of parameters
|
||||
* @param Object $object Object to use hooks on
|
||||
* @param array<string,mixed> $parameters Array of parameters
|
||||
* @param object $object Object to use hooks on
|
||||
* @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
|
||||
* @return int For 'addreplace' hooks (doActions, formConfirm, formObjectOptions, pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop/replace standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
|
||||
* @return int<-1,1> For 'addreplace' hooks (doActions, formConfirm, formObjectOptions, pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop/replace standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
|
||||
* For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0 if we want to keep standard actions, >0 uf we want to stop/replace standard actions (at least one > 0 and replacement will be done), <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
|
||||
* All types can also return some values into an array ->results that will be merged into this->resArray for caller.
|
||||
* $this->error or this->errors are also defined by class called by this function if error.
|
||||
|
|
@ -170,6 +185,7 @@ class HookManager
|
|||
'contexts' => $this->contextarray,
|
||||
'file' => $trace[0]['file'],
|
||||
'line' => $trace[0]['line'],
|
||||
'count' => 0,
|
||||
];
|
||||
$hash = md5(json_encode($hookInformations));
|
||||
if (!empty($this->hooksHistory[$hash])) {
|
||||
|
|
@ -245,6 +261,7 @@ class HookManager
|
|||
$error = 0;
|
||||
foreach ($this->hooks as $context => $modules) { // $this->hooks is an array with context as key and value is an array of modules that handle this context
|
||||
if (!empty($modules)) {
|
||||
'@phan-var-force array<string,CommonHookActions> $modules';
|
||||
// Loop on each active hooks of module for this context
|
||||
foreach ($modules as $module => $actionclassinstance) {
|
||||
$module = preg_replace('/^\d+:/', '', $module);
|
||||
|
|
@ -278,6 +295,7 @@ class HookManager
|
|||
$parameters['currentcontext'] = $context;
|
||||
// Hooks that must return int (hooks with type 'addreplace')
|
||||
if ($hooktype == 'addreplace') {
|
||||
// @phan-suppress-next-line PhanUndeclaredMethod The method's existence is tested above.
|
||||
$resactiontmp = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
|
||||
$resaction += $resactiontmp;
|
||||
|
||||
|
|
@ -298,9 +316,9 @@ class HookManager
|
|||
|
||||
if (!empty($actionclassinstance->resprints)) {
|
||||
if ($resactiontmp > 0) {
|
||||
$localResPrint = $actionclassinstance->resprints;
|
||||
$localResPrint = (string) $actionclassinstance->resprints;
|
||||
} else {
|
||||
$localResPrint .= $actionclassinstance->resprints;
|
||||
$localResPrint .= (string) $actionclassinstance->resprints;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -315,6 +333,7 @@ class HookManager
|
|||
dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
|
||||
}
|
||||
|
||||
// @phan-suppress-next-line PhanUndeclaredMethod The method's existence is tested above.
|
||||
$resactiontmp = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
|
||||
$resaction += $resactiontmp;
|
||||
|
||||
|
|
@ -322,7 +341,7 @@ class HookManager
|
|||
$localResArray = array_merge_recursive($localResArray, $actionclassinstance->results);
|
||||
}
|
||||
if (!empty($actionclassinstance->resprints)) {
|
||||
$localResPrint .= $actionclassinstance->resprints;
|
||||
$localResPrint .= (string) $actionclassinstance->resprints;
|
||||
}
|
||||
if (is_numeric($resactiontmp) && $resactiontmp < 0) {
|
||||
$error++;
|
||||
|
|
@ -342,8 +361,8 @@ class HookManager
|
|||
|
||||
//print "After hook context=".$context." ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."<br>\n";
|
||||
|
||||
unset($actionclassinstance->results);
|
||||
unset($actionclassinstance->resprints);
|
||||
$actionclassinstance->results = array();
|
||||
$actionclassinstance->resprints = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10712,9 +10712,9 @@ class Form
|
|||
|
||||
$ret = '';
|
||||
|
||||
$ret .= '<div class="divadvancedsearchfieldcomp inline-block">';
|
||||
$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';
|
||||
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
|
||||
$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>';
|
||||
$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth hideonsmartphone" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>';
|
||||
$ret .= '</a>';
|
||||
|
||||
$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
|
||||
|
|
|
|||
|
|
@ -606,7 +606,7 @@ if (!defined('MAIN_CUSTOM_REPORT_KEEP_GRAPH_ONLY')) {
|
|||
|
||||
// Filter (you can use param &show_search_component_params_hidden=1 for debug)
|
||||
if (!empty($object)) {
|
||||
print '<div class="divadvancedsearchfield quatrevingtpercent">';
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print $form->searchComponent(array($object->element => $object->fields), $search_component_params, array(), $search_component_params_hidden);
|
||||
print '</div>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ interface Database
|
|||
* @param string $nameoffield Name of field
|
||||
* @return string SQL string
|
||||
*/
|
||||
public function stddevPop($nameoffield);
|
||||
public function stddevpop($nameoffield);
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ abstract class DoliDB implements Database
|
|||
* @param string $nameoffield Name of field
|
||||
* @return string SQL string
|
||||
*/
|
||||
public function stddevPop($nameoffield)
|
||||
public function stddevpop($nameoffield)
|
||||
{
|
||||
return 'STDDEV_POP('.$nameoffield.')';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,6 +95,15 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu
|
|||
'table' => $object->table_element,
|
||||
'tablefromt' => $tablepath
|
||||
);
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
|
||||
$arrayofmesures[$tablealias.'.'.$key.'-stddevpop'] = array(
|
||||
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("StandardDeviationPop").')</span>',
|
||||
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
|
||||
'position' => ($position + ($count * 100000)).'.5',
|
||||
'table' => $object->table_element,
|
||||
'tablefromt' => $tablepath
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add extrafields to Measures
|
||||
|
|
@ -131,6 +140,15 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu
|
|||
'table' => $object->table_element,
|
||||
'tablefromt' => $tablepath
|
||||
);
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
|
||||
$arrayofmesures[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-stddevpop'] = array(
|
||||
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("StandardDeviationPop").')</span>',
|
||||
'labelnohtml' => $labelofobject.': '.$langs->trans($val),
|
||||
'position' => ($position + ($count * 100000)).'.5',
|
||||
'table' => $object->table_element,
|
||||
'tablefromt' => $tablepath
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
/* Copyright (C) 2010-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2024 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -1213,17 +1213,17 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
|
|||
$newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->hasRight('user', 'user', 'read'), '', $mainmenu, 'users', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"'));
|
||||
if ($user->hasRight('user', 'user', 'read')) {
|
||||
if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") {
|
||||
$newmenu->add("", $langs->trans("Users"), 1, $user->hasRight('user', 'user', 'lire') || $user->admin);
|
||||
$newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->hasRight("user", "user", "write") || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')), '', 'home');
|
||||
$newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->hasRight('user', 'user', 'lire') || $user->admin);
|
||||
$newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->hasRight('user', 'user', 'lire') || $user->admin);
|
||||
$newmenu->add("", $langs->trans("Users"), 1, $user->hasRight('user', 'user', 'read') || $user->admin);
|
||||
$newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->hasRight("user", "user", "write") || $user->admin) && !(isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')), '', 'home');
|
||||
$newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->hasRight('user', 'user', 'read') || $user->admin);
|
||||
$newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->hasRight('user', 'user', 'read') || $user->admin);
|
||||
if (isModEnabled('category')) {
|
||||
$langs->load("categories");
|
||||
$newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat');
|
||||
$newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->hasRight('categorie', 'read'), '', $mainmenu, 'cat');
|
||||
}
|
||||
$newmenu->add("", $langs->trans("Groups"), 1, ($user->hasRight('user', 'user', 'lire') || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')));
|
||||
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight("user", "group_advance", "create") : $user->hasRight("user", "user", "creer")) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')));
|
||||
$newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('user', 'group_advance', 'read') : $user->hasRight('user', 'user', 'lire')) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')));
|
||||
$newmenu->add("", $langs->trans("Groups"), 1, ($user->hasRight('user', 'user', 'read') || $user->admin) && !(isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')));
|
||||
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight("user", "group_advance", "write") : $user->hasRight("user", "user", "write")) || $user->admin) && !(isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')));
|
||||
$newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('user', 'group_advance', 'read') : $user->hasRight('user', 'user', 'read')) || $user->admin));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -999,7 +999,7 @@ class pdf_vinci extends ModelePDFMo
|
|||
$pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height);
|
||||
}
|
||||
|
||||
if (empty($hidetop)) {
|
||||
if (empty($hidetop) && array_key_exists('title', $colDef) && array_key_exists('width', $colDef)) {
|
||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||
|
||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -23,7 +24,6 @@
|
|||
|
||||
use DebugBar\DataCollector\RequestDataCollector;
|
||||
|
||||
|
||||
/**
|
||||
* DolRequestDataCollector class
|
||||
*/
|
||||
|
|
@ -32,7 +32,7 @@ class DolHooksCollector extends RequestDataCollector
|
|||
/**
|
||||
* Collects the data from the collectors
|
||||
*
|
||||
* @return array Array of collected data
|
||||
* @return array{nb_of_hooks:int,hooks:array<string,array{contexts:string}>} Array of collected data
|
||||
*/
|
||||
public function collect()
|
||||
{
|
||||
|
|
@ -41,7 +41,7 @@ class DolHooksCollector extends RequestDataCollector
|
|||
*/
|
||||
global $hookmanager;
|
||||
|
||||
$data = ['hooks' => []];
|
||||
$data = ['hooks' => [], 'nb_of_hooks' => 0];
|
||||
if (empty($hookmanager->hooksHistory)) {
|
||||
return $data;
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ class DolHooksCollector extends RequestDataCollector
|
|||
/**
|
||||
* Return widget settings
|
||||
*
|
||||
* @return array Array
|
||||
* @return array<string,array{icon?:string,widget?:string,map:string,default:int|string}> Array
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -43,9 +44,15 @@ $hookmanager->initHooks(array('index'));
|
|||
*/
|
||||
|
||||
$nbmodulesnotautoenabled = count($conf->modules);
|
||||
if (in_array('fckeditor', $conf->modules)) $nbmodulesnotautoenabled--;
|
||||
if (in_array('export', $conf->modules)) $nbmodulesnotautoenabled--;
|
||||
if (in_array('import', $conf->modules)) $nbmodulesnotautoenabled--;
|
||||
if (in_array('fckeditor', $conf->modules)) {
|
||||
$nbmodulesnotautoenabled--;
|
||||
}
|
||||
if (in_array('export', $conf->modules)) {
|
||||
$nbmodulesnotautoenabled--;
|
||||
}
|
||||
if (in_array('import', $conf->modules)) {
|
||||
$nbmodulesnotautoenabled--;
|
||||
}
|
||||
|
||||
// Check if company name is defined (first install)
|
||||
if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')) {
|
||||
|
|
@ -522,6 +529,7 @@ if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD') && getDolGlobalInt('MAI
|
|||
if (!empty($groupElement['lang'])) {
|
||||
$langs->load($groupElement['lang']);
|
||||
}
|
||||
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
|
||||
$groupName = $langs->trans($groupElement['groupName']);
|
||||
$groupKeyLowerCase = strtolower($groupKey);
|
||||
|
||||
|
|
|
|||
|
|
@ -457,6 +457,7 @@ VATNPR=Tax Rate NPR
|
|||
DefaultTaxRate=Default tax rate
|
||||
Average=Average
|
||||
Sum=Sum
|
||||
StandardDeviationPop=Standard deviation
|
||||
Delta=Delta
|
||||
StatusToPay=To pay
|
||||
RemainToPay=Remain to pay
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) ---Put here your own copyright and developer email---
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -52,7 +53,7 @@ class ActionsMyModule extends CommonHookActions
|
|||
public $results = array();
|
||||
|
||||
/**
|
||||
* @var string String displayed by executeHook() immediately after return
|
||||
* @var ?string String displayed by executeHook() immediately after return
|
||||
*/
|
||||
public $resprints;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
|
||||
* Copyright (C) 2023 Christophe Battarel <christophe.battarel@altairis.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
|
||||
|
|
@ -90,6 +91,7 @@ if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString
|
|||
?>
|
||||
<link rel="stylesheet" href="css/pos.css.php">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script>
|
||||
|
|
@ -150,6 +152,8 @@ if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString
|
|||
jQuery('#reduction_type_percent').html(htmlReductionPercent);
|
||||
jQuery('#reduction_type_amount').html(htmlReductionAmount);
|
||||
}
|
||||
|
||||
$("#reduction_total").focus();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -173,6 +177,8 @@ if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString
|
|||
console.log('ValidateReduction');
|
||||
reductionTotal = jQuery('#reduction_total').val();
|
||||
|
||||
reductionTotal = $("#reduction_total").val();
|
||||
|
||||
if (reductionTotal.length <= 0) {
|
||||
console.error('Error no reduction');
|
||||
return;
|
||||
|
|
@ -181,7 +187,7 @@ if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString
|
|||
var reductionNumber = parseFloat(reductionTotal);
|
||||
if (isNaN(reductionNumber)) {
|
||||
console.error('Error not a valid number :', reductionNumber);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (reductionType === 'percent') {
|
||||
|
|
@ -198,14 +204,33 @@ if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString
|
|||
});
|
||||
} else {
|
||||
console.error('Error bad reduction type :', reductionType);
|
||||
return false
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// manual input validation
|
||||
function formvalid(type) {
|
||||
reductionType = type;
|
||||
if (reductionType != "") {
|
||||
return ValidateReduction();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// console.log("Set initial focus");
|
||||
// $("#reduction_total").focus();
|
||||
</script>
|
||||
|
||||
<div style="position:absolute; top:2%; left:5%; width:91%;">
|
||||
<center>
|
||||
<?php
|
||||
print '<input type="text" class="takepospay" id="reduction_total" name="reduction_total" style="width: 50%;" placeholder="'.$langs->trans('Reduction').'">';
|
||||
print '<input type="text" class="takepospay width125" id="reduction_total" name="reduction_total" placeholder="'.$langs->trans('Reduction').'" autofocus>';
|
||||
if (getDolGlobalString('TAKEPOS_ADD_BUTTON_TO_ENTER_DISCOUNT_WITH_KEYBOARD')) {
|
||||
print '<input type="button" class="butAction" value="'.$langs->trans('AmountTTC').'" onclick="return formvalid(\'amount\');">';
|
||||
print '<input type="button" class="butAction" value="'.$langs->trans('Percentage').'" onclick="return formvalid(\'percent\');">';
|
||||
}
|
||||
?>
|
||||
</center>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1243,7 +1243,7 @@ div.divsearchfield {
|
|||
padding-<?php echo $left; ?>: 0;
|
||||
padding-<?php echo $right; ?>: 0;
|
||||
border-bottom: solid 1px var(--inputbordercolor);
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.search_component_searchtext {
|
||||
|
|
@ -1261,6 +1261,7 @@ div.divsearchfield {
|
|||
padding-bottom: 3px;
|
||||
background: #ddd;
|
||||
border-radius: 4px;
|
||||
display: inline-block;
|
||||
}
|
||||
.tagsearchdelete {
|
||||
color: #999;
|
||||
|
|
|
|||
|
|
@ -108,8 +108,15 @@ if (getDolGlobalString('MAIN_OVERWRITE_THEME_RES')) {
|
|||
}
|
||||
|
||||
// Define image path files and other constants
|
||||
$fontlist = 'arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif';
|
||||
//$fontlist='"open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;';
|
||||
|
||||
//$fontlist='helvetica, verdana, arial, sans-serif';
|
||||
//$fontlist='"open sans", "Helvetica Neue", Helvetica, Arial, sans-serif';
|
||||
|
||||
$fontlist = 'arial,tahoma,verdana,helvetica';
|
||||
if (getDolGlobalString('THEME_FONT_FAMILY')) {
|
||||
$fontlist = getDolGlobalString('THEME_FONT_FAMILY').', '.$fontlist;
|
||||
}
|
||||
|
||||
$img_head = '';
|
||||
$img_button = dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1);
|
||||
$dol_hide_topmenu = $conf->dol_hide_topmenu;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,10 @@ if (getDolGlobalString('MAIN_OVERWRITE_THEME_RES')) {
|
|||
|
||||
// Define image path files and other constants
|
||||
$fontlist = 'roboto,arial,tahoma,verdana,helvetica'; //$fontlist='verdana,helvetica,arial,sans-serif';
|
||||
if (getDolGlobalString('THEME_FONT_FAMILY')) {
|
||||
$fontlist = getDolGlobalString('THEME_FONT_FAMILY').', '.$fontlist;
|
||||
}
|
||||
|
||||
$img_head = '';
|
||||
$img_button = dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1);
|
||||
$dol_hide_topmenu = $conf->dol_hide_topmenu;
|
||||
|
|
@ -1415,7 +1419,7 @@ div.divsearchfield {
|
|||
padding-<?php echo $left; ?>: 0;
|
||||
padding-<?php echo $right; ?>: 0;
|
||||
border-bottom: solid 1px var(--inputbordercolor);
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
}
|
||||
.search_component_searchtext {
|
||||
padding-top: 2px;
|
||||
|
|
@ -1432,6 +1436,7 @@ div.divsearchfield {
|
|||
padding-bottom: 3px;
|
||||
background: #ddd;
|
||||
border-radius: 4px;
|
||||
display: inline-block;
|
||||
}
|
||||
.tagsearchdelete {
|
||||
color: #999;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2024 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
|
||||
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -93,21 +93,16 @@ if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
|||
}
|
||||
}
|
||||
|
||||
// Users/Groups management only in master entity if transverse mode
|
||||
if (isModEnabled('multicompany') && $conf->entity > 1 && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
if (!$user->hasRight("user", "user", "read") && !$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Defini si peux lire/modifier utilisateurs et permissions
|
||||
$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
|
||||
$permissiontodelete = ($user->admin || $user->hasRight("user", "user", "write"));
|
||||
$caneditperms = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight("user", "user", "write")));
|
||||
$permissiontodelete = $caneditperms;
|
||||
// Advanced permissions
|
||||
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
$caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write"));
|
||||
$caneditperms = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : ($user->admin || $user->hasRight("user", "group_advance", "write")));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -287,7 +282,7 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-l
|
|||
|
||||
if ($caneditperms) {
|
||||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=');
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu=', '', $caneditperms);
|
||||
}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2005-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2005-2024 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -40,7 +40,7 @@ $langs->load("users");
|
|||
|
||||
$canreadperms = true;
|
||||
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
$canreadperms = ($user->admin || $user->rights->user->group_advance->read);
|
||||
$canreadperms = (!empty($user->admin) || $user->hasRight("user", "group_advance", "read"));
|
||||
}
|
||||
|
||||
// Security check (for external users)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2024 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -198,15 +198,15 @@ if ($contextpage == 'employeelist' && !GETPOSTISSET('search_employee')) {
|
|||
}
|
||||
|
||||
// Define value to know what current user can do on users
|
||||
$permissiontoadd = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
|
||||
$permissiontoadd = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight("user", "user", "write")));
|
||||
$canreaduser = (!empty($user->admin) || $user->hasRight("user", "user", "read"));
|
||||
$canedituser = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
|
||||
$candisableuser = (!empty($user->admin) || $user->hasRight("user", "user", "delete"));
|
||||
$canedituser = $permissiontoadd;
|
||||
$candisableuser = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight("user", "user", "delete")));
|
||||
$canreadgroup = $canreaduser;
|
||||
$caneditgroup = $canedituser;
|
||||
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
$canreadgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "read"));
|
||||
$caneditgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "write"));
|
||||
$caneditgroup = (isModEnabled('multicompany') && !empty($user->entity) && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight("user", "group_advance", "write")));
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user