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

This commit is contained in:
Adrien Raze 2022-02-17 10:45:19 +01:00
commit f16567a44a
94 changed files with 819 additions and 198 deletions

View File

@ -476,7 +476,7 @@ class AccountingAccount extends CommonObject
*/
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '')
{
global $langs, $conf;
global $langs, $conf, $hookmanager;
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
if (!empty($conf->dol_no_mouse_hover)) {
@ -561,6 +561,15 @@ class AccountingAccount extends CommonObject
if ($withpicto != 2) {
$result .= $linkstart . $label_link . $linkend;
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -221,7 +221,7 @@ class AccountingJournal extends CommonObject
*/
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0)
{
global $langs, $conf, $user;
global $langs, $conf, $user, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -276,6 +276,15 @@ class AccountingJournal extends CommonObject
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array('accountingjournaldao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -460,7 +460,7 @@ class BookKeeping extends CommonObject
{
global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
global $menumanager, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -512,6 +512,15 @@ class BookKeeping extends CommonObject
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -7,7 +7,7 @@
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
@ -2164,7 +2164,7 @@ class Adherent extends CommonObject
*/
public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1, $notooltip = 0, $addlinktonotes = 0)
{
global $conf, $langs;
global $conf, $langs, $hookmanager;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) {
$withpictoimg = 0;
@ -2282,7 +2282,15 @@ class Adherent extends CommonObject
$result .= '</span>';
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -173,6 +173,7 @@ class DolibarrApi
unset($object->stats_mrptoproduce);
unset($object->element);
unset($object->element_for_permission);
unset($object->fk_element);
unset($object->table_element);
unset($object->table_element_line);

View File

@ -209,7 +209,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@ -272,7 +272,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -373,7 +373,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -665,7 +665,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -729,7 +729,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -797,7 +797,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -860,7 +860,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -933,7 +933,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1004,7 +1004,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1078,7 +1078,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1143,9 +1143,9 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(400, 'error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@ -1202,9 +1202,9 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(400, 'error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
@ -1261,7 +1261,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1324,7 +1324,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1383,7 +1383,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1449,7 +1449,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1508,7 +1508,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1567,7 +1567,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
@ -1628,7 +1628,7 @@ class Setup extends DolibarrApi
if ($sqlfilters) {
$errormessage = '';
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";

View File

@ -305,7 +305,7 @@ class Asset extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs;
global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
@ -360,7 +360,15 @@ class Asset extends CommonObject
}
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -847,7 +847,7 @@ class BOM extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('bomdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@ -1467,7 +1467,7 @@ class BOMLine extends CommonObjectLine
global $action, $hookmanager;
$hookmanager->initHooks(array('bomlinedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -344,7 +344,7 @@ class Bookmark extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('mybookmarkdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -10,7 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1612,7 +1612,7 @@ class Categorie extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $moreparam = '')
{
global $langs;
global $langs, $hookmanager;
$result = '';
$label = $langs->trans("ShowCategory").': '.($this->ref ? $this->ref : $this->label);
@ -1640,6 +1640,15 @@ class Categorie extends CommonObject
if ($withpicto != 2) {
$result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend;
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1669,7 +1669,7 @@ class ActionComm extends CommonObject
global $action;
$hookmanager->initHooks(array('actiondao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -740,7 +740,7 @@ class Mailing extends CommonObject
global $action;
$hookmanager->initHooks(array('emailingdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -1248,7 +1248,7 @@ class Propal extends CommonObject
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $line->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}
@ -3569,7 +3569,7 @@ class Propal extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = -1)
{
global $langs, $conf, $user;
global $langs, $conf, $user, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -3690,6 +3690,15 @@ class Propal extends CommonObject
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1486,8 +1486,11 @@ if ($resql) {
) {
$with_margin_info = true;
}
$total_ht = 0;
$total_margin = 0;
while ($i < min($num, $limit)) {
$last_num = min($num, $limit);
while ($i < $last_num) {
$obj = $db->fetch_object($resql);
$objectstatic->id = $obj->rowid;
@ -1541,6 +1544,8 @@ if ($resql) {
if ($with_margin_info === true) {
$objectstatic->fetch_lines();
$marginInfo = $formmargin->getMarginInfosArray($objectstatic);
$total_ht += $obj->total_ht;
$total_margin += $marginInfo['total_margin'];
}
print '<tr class="oddeven">';
@ -1959,7 +1964,7 @@ if ($resql) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_margin';
}
$totalarray['val']['total_margin'] += $marginInfo['total_margin'];
$totalarray['val']['total_margin'] = $total_margin;
}
// Total margin rate
if (!empty($arrayfields['total_margin_rate']['checked'])) {
@ -1974,6 +1979,16 @@ if ($resql) {
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
}
if ($i >= $last_num - 1) {
if (!empty($total_ht)) {
$totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
} else {
$totalarray['val']['total_mark_rate'] = '';
}
}
}
// Extra fields

View File

@ -421,7 +421,7 @@ if (empty($reshook)) {
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}

View File

@ -11,7 +11,7 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021-2022 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1056,7 +1056,7 @@ class Commande extends CommonOrder
return -1;
}
// Defined the new fk_parent_line
if ($result > 0 && $line->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}
@ -3663,7 +3663,7 @@ class Commande extends CommonOrder
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
{
global $conf, $langs, $user;
global $conf, $langs, $user, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -3764,6 +3764,15 @@ class Commande extends CommonOrder
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1463,8 +1463,11 @@ if ($resql) {
) {
$with_margin_info = true;
}
$total_ht = 0;
$total_margin = 0;
while ($i < min($num, $limit)) {
$last_num = min($num, $limit);
while ($i < $last_num) {
$obj = $db->fetch_object($resql);
$notshippable = 0;
@ -1510,6 +1513,8 @@ if ($resql) {
if ($with_margin_info === true) {
$generic_commande->fetch_lines();
$marginInfo = $formmargin->getMarginInfosArray($generic_commande);
$total_ht += $obj->total_ht;
$total_margin += $marginInfo['total_margin'];
}
print '<tr class="oddeven">';
@ -1879,6 +1884,16 @@ if ($resql) {
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
}
if ($i >= $last_num - 1) {
if (!empty($total_ht)) {
$totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
} else {
$totalarray['val']['total_mark_rate'] = '';
}
}
}
// Extra fields

View File

@ -1511,10 +1511,10 @@ class Account extends CommonObject
{
$country_code = $this->getCountryCode();
if (in_array($country_code, array('AD', 'FR', 'ES', 'GA', 'IT', 'NC'))) {
if (in_array($country_code, array('FR', 'ES', 'GA', 'IT', 'NC'))) {
return 1; // France, Spain, Gabon, ... - Not valid for CH
}
if (in_array($country_code, array('AU', 'BE', 'CA', 'DE', 'DK', 'GR', 'GB', 'ID', 'IE', 'IR', 'KR', 'NL', 'NZ', 'UK', 'US'))) {
if (in_array($country_code, array('AD', 'AU', 'BE', 'CA', 'DE', 'DK', 'GR', 'GB', 'ID', 'IE', 'IR', 'KR', 'NL', 'NZ', 'UK', 'US'))) {
return 2; // Australia, England...
}
return 0;

View File

@ -721,7 +721,7 @@ class PaymentVarious extends CommonObject
global $action;
$hookmanager->initHooks(array('variouspayment'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -466,7 +466,7 @@ class CashControl extends CommonObject
global $action;
$hookmanager->initHooks(array('cashfencedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -1270,7 +1270,7 @@ if (empty($reshook)) {
$object->lines[] = $line; // insert new line in current object
// Defined the new fk_parent_line
if ($result > 0 && $line->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}
@ -1781,7 +1781,7 @@ if (empty($reshook)) {
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}

View File

@ -1388,7 +1388,7 @@ class FactureRec extends CommonInvoice
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1)
{
global $langs;
global $langs, $hookmanager;
$result = '';
@ -1440,7 +1440,15 @@ class FactureRec extends CommonInvoice
$result .= $this->ref;
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -788,6 +788,9 @@ class Facture extends CommonInvoice
dol_syslog("There is ".count($this->lines)." lines that are invoice lines objects");
foreach ($this->lines as $i => $val) {
$newinvoiceline = $this->lines[$i];
$newinvoiceline->context = $this->context;
$newinvoiceline->fk_facture = $this->id;
$newinvoiceline->origin = $this->lines[$i]->element;
@ -820,7 +823,7 @@ class Facture extends CommonInvoice
$result = $newinvoiceline->insert();
// Defined the new fk_parent_line
if ($result > 0 && $newinvoiceline->product_type == 9) {
if ($result > 0) {
$fk_parent_line = $result;
}
}
@ -1569,7 +1572,7 @@ class Facture extends CommonInvoice
global $action, $hookmanager;
$hookmanager->initHooks(array('invoicedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result, 'notooltip' => $notooltip, 'addlinktonotes' => $addlinktonotes, 'save_lastsearch_value'=> $save_lastsearch_value, 'target' => $target);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result, 'notooltip' => $notooltip, 'addlinktonotes' => $addlinktonotes, 'save_lastsearch_value'=> $save_lastsearch_value, 'target' => $target);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -1651,8 +1651,11 @@ if ($resql) {
) {
$with_margin_info = true;
}
$total_ht = 0;
$total_margin = 0;
while ($i < min($num, $limit)) {
$last_num = min($num, $limit);
while ($i < $last_num) {
$obj = $db->fetch_object($resql);
$datelimit = $db->jdate($obj->datelimite);
@ -1740,6 +1743,8 @@ if ($resql) {
if ($with_margin_info === true) {
$facturestatic->fetch_lines();
$marginInfo = $formmargin->getMarginInfosArray($facturestatic);
$total_ht += $obj->total_ht;
$total_margin += $marginInfo['total_margin'];
}
print '<tr class="oddeven"';
@ -2231,6 +2236,16 @@ if ($resql) {
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
}
if ($i >= $last_num - 1) {
if (!empty($total_ht)) {
$totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
} else {
$totalarray['val']['total_mark_rate'] = '';
}
}
}
// Extra fields

View File

@ -1209,7 +1209,15 @@ class Paiement extends CommonObject
$result .= ($this->ref ? $this->ref : $this->id);
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1260,7 +1260,7 @@ class BonPrelevement extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('banktransferdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2016-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
@ -560,7 +560,7 @@ class ChargeSociales extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1)
{
global $langs, $conf, $user, $form;
global $langs, $conf, $user, $form, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -625,7 +625,15 @@ class ChargeSociales extends CommonObject
$result .= $this->ref;
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1488,7 +1488,7 @@ class Contact extends CommonObject
global $action;
$hookmanager->initHooks(array('contactdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -2042,7 +2042,7 @@ class Contrat extends CommonObject
global $action;
$hookmanager->initHooks(array('contractdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
@ -2591,6 +2591,12 @@ class ContratLigne extends CommonObjectLine
*/
public $table_element = 'contratdet';
/**
* @var string Name to use for 'features' parameter to check module permissions with restrictedArea()
*/
public $element_for_permission = 'contrat';
/**
* @var int ID
*/
@ -2723,6 +2729,34 @@ class ContratLigne extends CommonObjectLine
const STATUS_CLOSED = 5;
// BEGIN MODULEBUILDER PROPERTIES
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'qty' =>array('type'=>'integer', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35, 'isameasure'=>1),
'total_ht' =>array('type'=>'integer', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>36, 'isameasure'=>1),
'total_tva' =>array('type'=>'integer', 'label'=>'AmountVAT', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>37, 'isameasure'=>1),
'total_ttc' =>array('type'=>'integer', 'label'=>'AmountTTC', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>38, 'isameasure'=>1),
//'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
//'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_contrat' =>array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'Contract', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_product' =>array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
//'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
//'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
//'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
//'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserOpen', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserCloture', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 4=>'Open', 5=>'Closed'))
);
// END MODULEBUILDER PROPERTIES
/**
* Constructor

View File

@ -83,6 +83,11 @@ abstract class CommonObject
*/
public $element;
/**
* @var string Name to use for 'features' parameter to check module permissions with restrictedArea(). Undefined means same value than $element.
*/
public $element_for_permission;
/**
* @var string Name of table without prefix where object is stored
*/

View File

@ -2219,9 +2219,10 @@ class Form
* 'warehouseinternal' = count products from warehouses for internal correct/transfer only
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @param string $nooutput No print, return the output into a string
* @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
* @return void|string
*/
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0)
public function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0, $status_purchase = -1)
{
// phpcs:enable
global $langs, $conf;
@ -2261,7 +2262,7 @@ class Form
}
}
// mode=1 means customers products
$urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
$urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
//Price by customer
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
$urloption .= '&socid='.$socid;
@ -2357,7 +2358,7 @@ class Form
$out .= img_picto($langs->trans("Search"), 'search');
}
} else {
$out .= $this->select_produits_list($selected, $htmlname, $filtertype, $limit, $price_level, '', $status, $finished, 0, $socid, $showempty, $forcecombo, $morecss, $hidepriceinlabel, $warehouseStatus);
$out .= $this->select_produits_list($selected, $htmlname, $filtertype, $limit, $price_level, '', $status, $finished, 0, $socid, $showempty, $forcecombo, $morecss, $hidepriceinlabel, $warehouseStatus, $status_purchase);
}
if (empty($nooutput)) {
@ -2453,9 +2454,10 @@ class Form
* 'warehouseopen' = count products from open warehouses,
* 'warehouseclosed' = count products from closed warehouses,
* 'warehouseinternal' = count products from warehouses for internal correct/transfer only
* @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
* @return array Array of keys for json
*/
public function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '')
public function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $status_purchase = -1)
{
// phpcs:enable
global $langs, $conf;
@ -2593,6 +2595,9 @@ class Form
} elseif ($status >= 0) {
$sql .= " AND p.tosell = ".((int) $status);
}
if ($status_purchase >= 0) {
$sql .= " AND p.tobuy = ".((int) $status_purchase);
}
// Filter by product type
if (strval($filtertype) != '') {
$sql .= " AND p.fk_product_type = ".((int) $filtertype);
@ -7379,7 +7384,17 @@ class Form
$objecttmp = null;
$InfoFieldList = explode(":", $objectdesc);
// Example of value for $objectdec:
// Bom:bom/class/bom.class.php:0:t.status=1
// Bom:bom/class/bom.class.php:0:t.status=1:ref
// Bom:bom/class/bom.class.php:0:(t.status:=:1):ref
$InfoFieldList = explode(":", $objectdesc, 4);
$vartmp = $InfoFieldList[3];
$reg = array();
if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
$InfoFieldList[4] = $reg[1]; // take the sort field
}
$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
$classname = $InfoFieldList[0];
$classpath = $InfoFieldList[1];
@ -8123,8 +8138,15 @@ class Form
}
$out .= '};'."\n";
$out .= '$(document).ready(function () {
$(\'#'.$htmlname.'\').'.$tmpplugin.'({
dir: \'ltr\',
$(\'#'.$htmlname.'\').'.$tmpplugin.'({';
if ($placeholder) {
$out .= '
placeholder: {
id: \'-1\',
text: \''.dol_escape_js($placeholder).'\'
},';
}
$out .= ' dir: \'ltr\',
// Specify format function for dropdown item
formatResult: formatResult,
templateResult: formatResult, /* For 4.0 */
@ -9741,24 +9763,45 @@ class Form
$ret = '';
$ret .= '<div class="nowrap centpercent">';
$ret .= '<div class="divadvancedsearchfieldcomp inline-block">';
//$ret .= '<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor paddingright">';
$ret .= '<span class="fas fa-filter linkobject boxfilter" title="Filter" id="idsubimgproductdistribution"></span>';
$ret .= $langs->trans("Filters");
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
$ret .= '<span class="fas fa-filter linkobject boxfilter pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>';
//$ret .= $langs->trans("Filters");
$ret .= '</a>';
//$ret .= '<button type="submit" class="liste_titre button_search paddingleftonly" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
$ret .= '<div name="search_component_params" class="search_component_params inline-block minwidth500 maxwidth300onsmartphone valignmiddle">';
$texttoshow = '<div class="opacitymedium inline-block search_component_searchtext">'.$langs->trans("Search").'</div>';
$ret .= '<div class="search_component inline-block valignmiddle">'.$texttoshow.'</div>';
$ret .= '</div>';
$ret .= "<!-- Syntax of Generic filter string: t.ref:like:'SO-%', t.date_creation:<:'20160101', t.date_creation:<:'2016-01-01 12:30:00', t.nature:is:NULL, t.field2:isnot:NULL -->\n";
if (GETPOST('show_search_component_params_hidden', 'int')) {
$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
// Show select fields as tags.
$ret .= '<div name="divsearch_component_params" class="noborderbottom search_component_params inline-block valignmiddle">';
if ($search_component_params_hidden) {
if (!preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with ()
$search_component_params_hidden .= '('.$search_component_params_hidden.')';
}
$errormessage = '';
if (!dolCheckFilters($search_component_params_hidden, $errormessage)) {
print 'ERROR in parsing search string';
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
//var_dump($search_component_params_hidden);
$htmltags = preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $search_component_params_hidden);
//var_dump($htmltags);
$ret .= '<span class="marginleftonlyshort valignmiddle tagsearch"><span class="tagsearchdelete select2-selection__choice__remove">x</span> '.$htmltags.'</span>';
}
//$ret .= '<button type="submit" class="liste_titre button_search paddingleftonly" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
//$ret .= search_component_params
//$texttoshow = '<div class="opacitymedium inline-block search_component_searchtext">'.$langs->trans("Search").'</div>';
//$ret .= '<div class="search_component inline-block valignmiddle">'.$texttoshow.'</div>';
$show_search_component_params_hidden = 1;
if ($show_search_component_params_hidden) {
$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
}
$ret .= '<input type="'.(GETPOST('show_search_component_params_hidden', 'int') ? 'text' : 'hidden').'" name="search_component_params_hidden" class="search_component_params_hidden marginleftonly" value="'.$search_component_params_hidden.'">';
$ret .= "<!-- We store the full search string into this field. For example: (t.ref:like:'SO-%') and ((t.ref:like:'CO-%') or (t.ref:like:'AA%')) -->";
$ret .= '<input type="hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';
// For compatibility with forms that show themself the search criteria in addition of this component, we output the fields
foreach ($arrayofcriterias as $criterias) {
foreach ($criterias as $criteriafamilykey => $criteriafamilyval) {
@ -9782,8 +9825,14 @@ class Form
}
}
}
$ret .= '</div>';
$ret .= "<!-- Syntax of Generic filter string: t.ref:like:'SO-%', t.date_creation:<:'20160101', t.date_creation:<:'2016-01-01 12:30:00', t.nature:is:NULL, t.field2:isnot:NULL -->\n";
$ret .= '<input type="text" placeholder="'.$langs->trans("Search").'" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
$ret .= '</div>';
$ret .= '</div>';
return $ret;
}

View File

@ -1479,9 +1479,10 @@ class FormOther
* @param array $search_groupby Array of preselected fields
* @param array $arrayofgroupby Array of groupby to fill
* @param string $morecss More CSS
* @param string $showempty '1' or 'text'
* @return string HTML string component
*/
public function selectGroupByField($object, $search_groupby, &$arrayofgroupby, $morecss = 'minwidth200 maxwidth250')
public function selectGroupByField($object, $search_groupby, &$arrayofgroupby, $morecss = 'minwidth200 maxwidth250', $showempty = '1')
{
global $langs, $extrafields, $form;
@ -1493,7 +1494,7 @@ class FormOther
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
foreach ($object->fields as $key => $val) {
if (!$val['measure']) {
if (!$val['isameasure']) {
if (in_array($key, array(
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) {
@ -1541,7 +1542,7 @@ class FormOther
foreach ($arrayofgroupby as $key => $val) {
$arrayofgroupbylabel[$key] = $val['label'];
}
$result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, 1, 0, 0, '', 0, 0, 0, '', $morecss, 1);
$result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
return $result;
}
@ -1552,9 +1553,10 @@ class FormOther
* @param mixed $object Object analyzed
* @param array $search_xaxis Array of preselected fields
* @param array $arrayofxaxis Array of groupby to fill
* @return string HTML string component
* @param string $showempty '1' or 'text'
* @return string HTML string component
*/
public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis)
public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis, $showempty = '1')
{
global $langs, $extrafields, $form;
@ -1589,9 +1591,9 @@ class FormOther
continue;
}
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y');
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m');
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d');
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', 'position' => $val['position'].'-y');
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', 'position' => $val['position'].'-m');
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', 'position' => $val['position'].'-d');
} else {
$arrayofxaxis['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
}
@ -1617,7 +1619,7 @@ class FormOther
foreach ($arrayofxaxis as $key => $val) {
$arrayofxaxislabel[$key] = $val['label'];
}
$result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 1, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
$result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
return $result;
}

View File

@ -99,7 +99,8 @@ $arrayoftype = array(
'order' => array('label' => 'Orders', 'ObjectClassName' => 'Commande', 'enabled' => $conf->commande->enabled, 'ClassPath' => "/commande/class/commande.class.php"),
'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/facture/class/facture.class.php"),
'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/class/facturerec.class.php", 'langs'=>'bills'),
'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contract'),
'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contracts'),
'contractdet' => array('label' => 'ContractLines', 'ObjectClassName' => 'ContratLigne', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contracts'),
'bom' => array('label' => 'BOM', 'ObjectClassName' => 'Bom', 'enabled' => $conf->bom->enabled),
'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mrp->enabled, 'ClassPath' => "/mrp/class/mo.class.php"),
'ticket' => array('label' => 'Ticket', 'ObjectClassName' => 'Ticket', 'enabled' => $conf->ticket->enabled),
@ -159,6 +160,11 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
$search_component_params = array('');
$search_component_params_hidden = GETPOST('search_component_params_hidden', 'alphanohtml');
// For the case we enter a criteria manually, the search_component_params_input will be defined and must be used in priority
if (GETPOST('search_component_params_input', 'alphanohtml')) {
$search_component_params_hidden = GETPOST('search_component_params_input', 'alphanohtml');
}
$MAXUNIQUEVALFORGROUP = 20;
$MAXMEASURESINBARGRAPH = 20;
@ -175,7 +181,12 @@ $arrayofgroupby = array();
$arrayofyaxis = array();
$arrayofvaluesforgroupby = array();
restrictedArea($user, $object->element, 0, '');
$features = $object->element;
if (!empty($object->element_for_permission)) {
$features = $object->element_for_permission;
}
restrictedArea($user, $features, 0, '');
$error = 0;
@ -420,22 +431,22 @@ if ($object->isextrafieldmanaged) {
}
}
}
print '<div class="inline-block"><span class="fas fa-chart-line paddingright" title="'.$langs->trans("Measures").'"></span>'.$langs->trans("Measures").'</div> ';
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1);
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span><span class="fas fa-caret-left caretleftaxis" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span></div>';
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields
print '</div>';
// XAxis
print '<div class="divadvancedsearchfield">';
print '<div class="inline-block"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("XAxis").'"></span>'.$langs->trans("XAxis").'</div> ';
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis);
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span><span class="fas fa-caret-down caretdownaxis" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span></div>';
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis")); // Fill the array $arrayofxaxis with possible fields
print '</div>';
// Group by
print '<div class="divadvancedsearchfield">';
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("GroupBy").'"></span>'.$langs->trans("GroupBy").'</div> ';
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby);
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("GroupBy")).'"></span></div>';
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields
print '</div>';
@ -561,7 +572,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) {
$sql .= ' AND entity IN ('.getEntity($object->element).')';
}
// Add the where here
$sqlfilters = GETPOST('search_component_params_hidden', 'alphanohtml');
$sqlfilters = $search_component_params_hidden;
if ($sqlfilters) {
$errormessage = '';
if (dolCheckFilters($sqlfilters, $errormessage)) {

View File

@ -10801,7 +10801,7 @@ function dolForgeCriteriaCallback($matches)
{
global $db;
//dol_syslog("Convert matches ".$matches[1]);
dol_syslog("Convert matches ".$matches[1]);
if (empty($matches[1])) {
return '';
}

View File

@ -892,8 +892,10 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
}
if ($feature == 'expensereport') {
$useridtocheck = $object->fk_user_author;
if (!in_array($useridtocheck, $childids)) {
return false;
if (!$user->rights->expensereport->readall) {
if (!in_array($useridtocheck, $childids)) {
return false;
}
}
}
}

View File

@ -725,7 +725,7 @@ class Delivery extends CommonObject
*/
public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1)
{
global $langs;
global $langs, $hookmanager;
$result = '';
@ -757,6 +757,16 @@ class Delivery extends CommonObject
$result .= ' ';
}
$result .= $linkstart.$this->ref.$linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -913,7 +913,7 @@ class Don extends CommonObject
*/
public function getNomUrl($withpicto = 0, $notooltip = 0, $moretitle = '', $save_lastsearch_value = -1)
{
global $conf, $langs;
global $conf, $langs, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -953,7 +953,15 @@ class Don extends CommonObject
$result .= $this->ref;
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -661,7 +661,7 @@ class PaymentDonation extends CommonObject
*/
public function getNomUrl($withpicto = 0, $maxlen = 0)
{
global $langs;
global $langs, $hookmanager;
$result = '';
@ -684,6 +684,15 @@ class PaymentDonation extends CommonObject
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}
}

View File

@ -474,7 +474,7 @@ class EcmDirectory extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $more = '', $notooltip = 0)
{
global $langs;
global $langs, $hookmanager;
$result = '';
//$newref=str_replace('_',' ',$this->ref);
@ -506,6 +506,15 @@ class EcmDirectory extends CommonObject
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -831,7 +831,7 @@ class EcmFiles extends CommonObject
{
global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
global $menumanager, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -868,6 +868,16 @@ class EcmFiles extends CommonObject
}
}
$result .= $linkstart.$this->ref.$linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -563,7 +563,7 @@ class EmailCollector extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('emailcollectordao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -389,7 +389,7 @@ class EmailCollectorAction extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('emailcollectoractiondao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -363,7 +363,7 @@ class EmailCollectorFilter extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('emailcollectorfilterdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -602,7 +602,7 @@ class ConferenceOrBooth extends ActionComm
global $action, $hookmanager;
$hookmanager->initHooks(array('conferenceorboothdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -855,7 +855,7 @@ class ConferenceOrBoothAttendee extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('conferenceorboothattendeedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -11,7 +11,7 @@
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2016-2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Lenin Rivas <lenin@leninrivas.com>
*
* This program is free software; you can redistribute it and/or modify
@ -1778,7 +1778,7 @@ class Expedition extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1)
{
global $langs, $conf;
global $langs, $conf, $hookmanager;
$result = '';
$label = '<u>'.$langs->trans("Shipment").'</u>';
@ -1824,7 +1824,15 @@ class Expedition extends CommonObject
$result .= $this->ref;
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1640,7 +1640,7 @@ class ExpenseReport extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
{
global $langs, $conf;
global $langs, $conf, $hookmanager;
$result = '';
@ -1709,6 +1709,15 @@ class ExpenseReport extends CommonObject
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -628,7 +628,7 @@ class PaymentExpenseReport extends CommonObject
*/
public function getNomUrl($withpicto = 0, $maxlen = 0)
{
global $langs;
global $langs, $hookmanager;
$result = '';
@ -660,7 +660,15 @@ class PaymentExpenseReport extends CommonObject
$result .= $link.($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref).$linkend;
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -816,7 +816,7 @@ class Fichinter extends CommonObject
global $action;
$hookmanager->initHooks(array('interventiondao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -628,7 +628,7 @@ class FichinterRec extends Fichinter
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '')
{
global $langs;
global $langs, $hookmanager;
$result = '';
$label = $langs->trans("ShowInterventionModel").': '.$this->ref;
@ -653,6 +653,15 @@ class FichinterRec extends Fichinter
if ($withpicto != 2) {
$result .= $link.$this->ref.$linkend;
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -9,7 +9,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021 Josep Lluís Amador <joseplluis@lliuretic.cat>
*
@ -791,7 +791,7 @@ class CommandeFournisseur extends CommonOrder
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
{
global $langs, $conf, $user;
global $langs, $conf, $user, $hookmanager;
$result = '';
@ -873,6 +873,15 @@ class CommandeFournisseur extends CommonOrder
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1377,7 +1377,7 @@ class FactureFournisseurRec extends CommonInvoice
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1)
{
global $langs;
global $langs, $hookmanager;
$result = '';
@ -1429,7 +1429,15 @@ class FactureFournisseurRec extends CommonInvoice
$result .= $this->ref;
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -2696,7 +2696,7 @@ class FactureFournisseur extends CommonInvoice
*/
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
{
global $langs, $conf, $user;
global $langs, $conf, $user, $hookmanager;
$result = '';
@ -2814,7 +2814,15 @@ class FactureFournisseur extends CommonInvoice
$result .= '</span>';
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1092,7 +1092,7 @@ class ProductFournisseur extends Product
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $db, $conf, $langs;
global $db, $conf, $langs, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -1227,6 +1227,15 @@ class ProductFournisseur extends Product
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -594,7 +594,7 @@ class PaiementFourn extends Paiement
*/
public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0, $morecss = '')
{
global $langs;
global $langs, $conf, $hookmanager;
$result = '';
@ -639,6 +639,15 @@ class PaiementFourn extends Paiement
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -1270,7 +1270,7 @@ class Holiday extends CommonObject
*/
public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1, $notooltip = 0)
{
global $langs;
global $langs, $hookmanager;
$result = '';
@ -1305,7 +1305,15 @@ class Holiday extends CommonObject
$result .= $this->ref;
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -506,7 +506,7 @@ class Establishment extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('establishmentdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -808,7 +808,7 @@ class Evaluation extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('evaluationdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -780,7 +780,7 @@ class Evaluationline extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('evaluationlinedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -814,7 +814,7 @@ class Job extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('jobdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -788,7 +788,7 @@ class Position extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('positiondao'));
$parameters = array('id' => $this->id, 'getnomurl' => $result);
$parameters = array('id' => $this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -854,7 +854,7 @@ class Skill extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('jobdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -768,7 +768,7 @@ class Skilldet extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('skilldetdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -807,7 +807,7 @@ class SkillRank extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('skillrankdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -791,7 +791,7 @@ class KnowledgeRecord extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('knowledgerecorddao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -20,6 +20,7 @@ ContractsSubscriptions=Contracts/Subscriptions
ContractsAndLine=Contracts and line of contracts
Contract=Contract
ContractLine=Contract line
ContractLines=Contract lines
Closing=Closing
NoContracts=No contracts
MenuServices=Services

View File

@ -556,7 +556,7 @@ class Loan extends CommonObject
*/
public function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $conf, $langs;
global $conf, $langs, $hookmanager;
$result = '';
@ -606,6 +606,15 @@ class Loan extends CommonObject
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -617,7 +617,7 @@ class PaymentLoan extends CommonObject
*/
public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $moretitle = '', $save_lastsearch_value = -1)
{
global $langs, $conf;
global $langs, $conf, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -654,6 +654,15 @@ class PaymentLoan extends CommonObject
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}
}

View File

@ -510,6 +510,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt(
print $langs->trans("ErrorGoBackAndCorrectParameters");
die;
} else {
http_response_code(403);
if (defined('CSRFCHECK_WITH_TOKEN')) {
dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (CSRFCHECK_WITH_TOKEN protection) in main.inc.php. Token not provided.", LOG_WARNING);
print "Access to a page that needs a token (constant CSRFCHECK_WITH_TOKEN is defined) is refused by CSRF protection in main.inc.php. Token not provided.\n";

View File

@ -46,6 +46,9 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$sortfield=GETPOST('sortfield', 'alpha');
$sortorder=GETPOST('sortorder', 'alpha');
$module = GETPOST('module', 'alpha');
$tab = GETPOST('tab', 'aZ09');
$tabobj = GETPOST('tabobj', 'alpha');
@ -2296,7 +2299,7 @@ if ($module == 'initmodule') {
print_liste_field_titre("Condition", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print "</tr>\n";
if (is_array($dicts) && is_array($dicts['tabname'])) {
if (!empty($dicts) && is_array($dicts) && !empty($dicts['tabname']) && is_array($dicts['tabname'])) {
$i = 0;
$maxi = count($dicts['tabname']);
while ($i < $maxi) {
@ -2778,25 +2781,25 @@ if ($module == 'initmodule') {
$propname = $propkey;
$proplabel = $propval['label'];
$proptype = $propval['type'];
$proparrayofkeyval = $propval['arrayofkeyval'];
$proparrayofkeyval = !empty($propval['arrayofkeyval'])?$propval['arrayofkeyval']:'';
$propnotnull = $propval['notnull'];
$propdefault = $propval['default'];
$propindex = $propval['index'];
$propforeignkey = $propval['foreignkey'];
$propdefault = !empty($propval['default'])?$propval['default']:'';
$propindex = !empty($propval['index'])?$propval['index']:'';
$propforeignkey = !empty($propval['foreignkey'])?$propval['foreignkey']:'';
$propposition = $propval['position'];
$propenabled = $propval['enabled'];
$propvisible = $propval['visible'];
$propnoteditable = $propval['noteditable'];
$propsearchall = $propval['searchall'];
$propisameasure = $propval['isameasure'];
$propcss = $propval['css'];
$propcssview = $propval['cssview'];
$propcsslist = $propval['csslist'];
$prophelp = $propval['help'];
$propshowoncombobox = $propval['showoncombobox'];
$propnoteditable = !empty($propval['noteditable'])?$propval['noteditable']:0;
$propsearchall = !empty($propval['searchall'])?$propval['searchall']:0;
$propisameasure = !empty($propval['isameasure'])?$propval['isameasure']:0;
$propcss = !empty($propval['css'])?$propval['css']:'';
$propcssview = !empty($propval['cssview'])?$propval['cssview']:'';
$propcsslist = !empty($propval['csslist'])?$propval['csslist']:'';
$prophelp = !empty($propval['help'])?$propval['help']:'';
$propshowoncombobox = !empty($propval['showoncombobox'])?$propval['showoncombobox']:0;
//$propdisabled=$propval['disabled'];
$propvalidate = $propval['validate'];
$propcomment = $propval['comment'];
$propvalidate = !empty($propval['validate'])?$propval['validate']:0;
$propcomment = !empty($propval['comment'])?$propval['comment']:'';
print '<tr class="oddeven">';

View File

@ -28,10 +28,10 @@ There is a [Transifex project](https://transifex.com/projects/p/dolibarr-module-
### From the ZIP file and GUI interface
- If you get the module in a zip file (like when downloading it from the market place [Dolistore](https://www.dolistore.com)), go into
menu ```Home - Setup - Modules - Deploy external module``` and upload the zip file.
If the module is a ready to deploy zip file, so with a name module_xxx-version.zip (like when downloading it from a market place like [Dolistore](https://www.dolistore.com)),
go into menu ```Home - Setup - Modules - Deploy external module``` and upload the zip file.
Note: If this screen tell you there is no custom directory, check your setup is correct:
Note: If this screen tell you that there is no "custom" directory, check that your setup is correct:
- In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file and check that following lines are not commented:
@ -58,7 +58,7 @@ Note: If this screen tell you there is no custom directory, check your setup is
### From a GIT repository
- Clone the repository in ```$dolibarr_main_document_root_alt/mymodule```
Clone the repository in ```$dolibarr_main_document_root_alt/mymodule```
```sh
cd ....../custom

View File

@ -836,7 +836,7 @@ class MyObject extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('myobjectdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -1072,7 +1072,7 @@ class Mo extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('modao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -1045,7 +1045,7 @@ class Partnership extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('partnershipdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -434,7 +434,7 @@ class PartnershipType extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('myobjectdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -51,7 +51,8 @@ $htmlname = GETPOST('htmlname', 'aZ09');
$socid = GETPOST('socid', 'int');
$type = GETPOST('type', 'int');
$mode = GETPOST('mode', 'int');
$status = ((GETPOST('status', 'int') >= 0) ? GETPOST('status', 'int') : - 1);
$status = ((GETPOST('status', 'int') >= 0) ? GETPOST('status', 'int') : - 1); // status buy when mode = customer , status purchase when mode = supplier
$status_purchase = ((GETPOST('status_purchase', 'int') >= 0) ? GETPOST('status_purchase', 'int') : - 1); // status purchase when mode = customer
$outjson = (GETPOST('outjson', 'int') ? GETPOST('outjson', 'int') : 0);
$price_level = GETPOST('price_level', 'int');
$action = GETPOST('action', 'aZ09');
@ -260,7 +261,7 @@ if ($action == 'fetch' && !empty($id)) {
}
if (empty($mode) || $mode == 1) { // mode=1: customer
$arrayresult = $form->select_produits_list("", $htmlname, $type, 0, $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', $hidepriceinlabel, $warehouseStatus);
$arrayresult = $form->select_produits_list("", $htmlname, $type, 0, $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', $hidepriceinlabel, $warehouseStatus, $status_purchase);
} elseif ($mode == 2) { // mode=2: supplier
$arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, 0, $alsoproductwithnosupplierprice);
}

View File

@ -4943,7 +4943,7 @@ class Product extends CommonObject
global $action;
$hookmanager->initHooks(array('productdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -642,7 +642,7 @@ class ProductFournisseurPrice extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('productfournisseurpricedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;

View File

@ -760,7 +760,7 @@ class Entrepot extends CommonObject
global $action;
$hookmanager->initHooks(array('warehousedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result, 'withpicto' => $withpicto, 'option' => $option, 'showfullpath' => $showfullpath, 'notooltip'=> $notooltip);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result, 'withpicto' => $withpicto, 'option' => $option, 'showfullpath' => $showfullpath, 'notooltip'=> $notooltip);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -1264,7 +1264,7 @@ class Project extends CommonObject
global $action;
$hookmanager->initHooks(array('projectdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -635,11 +635,24 @@ class Reception extends CommonObject
}
}
// Change status of order to "reception in process"
$ret = $this->setStatut(4, $this->origin_id, 'commande_fournisseur');
if (!$ret) {
// Change status of order to "reception in process" or "totally received"
$status = $this->getStatusDispatch();
if ($status < 0) {
$error++;
} else {
$trigger_key = '';
if ($status == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) {
$ret = $this->commandeFournisseur->Livraison($user, dol_now(), 'tot', '');
if ($ret < 0) {
$error++;
$this->errors = array_merge($this->errors, $this->commandeFournisseur->errors);
}
} else {
$ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur', $trigger_key);
if ($ret < 0) {
$error++;
}
}
}
if (!$error && !$notrigger) {
@ -707,7 +720,92 @@ class Reception extends CommonObject
}
}
/**
* Get status from all dispatched lines
*
* @return int <0 if KO, Status of reception if OK
*/
public function getStatusDispatch()
{
global $conf;
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php';
$status = CommandeFournisseur::STATUS_RECEIVED_PARTIALLY;
if (!empty($this->origin) && $this->origin_id > 0 && ($this->origin == 'order_supplier' || $this->origin == 'commandeFournisseur')) {
if (empty($this->commandeFournisseur)) {
$this->commandeFournisseur = null;
$this->fetch_origin();
if (empty($this->commandeFournisseur->lines)) {
$res = $this->commandeFournisseur->fetch_lines();
if ($res < 0) return $res;
}
}
$qty_received = array();
$qty_wished = array();
$supplierorderdispatch = new CommandeFournisseurDispatch($this->db);
$filter = array('t.fk_commande'=>$this->origin_id);
if (!empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) {
$filter['t.status'] = 1; // Restrict to lines with status validated
}
$ret = $supplierorderdispatch->fetchAll('', '', 0, 0, $filter);
if ($ret < 0) {
$this->error = $supplierorderdispatch->error;
$this->errors = $supplierorderdispatch->errors;
return $ret;
} else {
// build array with quantity received by product in all supplier orders (origin)
foreach ($supplierorderdispatch->lines as $dispatch_line) {
$qty_received[$dispatch_line->fk_product] += $dispatch_line->qty;
}
// qty wished in order supplier (origin)
foreach ($this->commandeFournisseur->lines as $origin_line) {
// exclude lines not qualified for reception
if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $origin_line->product_type > 0) {
continue;
}
$qty_wished[$origin_line->fk_product] += $origin_line->qty;
}
// compare array
$diff_array = array_diff_assoc($qty_received, $qty_wished); // Warning: $diff_array is done only on common keys.
$keys_in_wished_not_in_received = array_diff(array_keys($qty_wished), array_keys($qty_received));
$keys_in_received_not_in_wished = array_diff(array_keys($qty_received), array_keys($qty_wished));
if (count($diff_array) == 0 && count($keys_in_wished_not_in_received) == 0 && count($keys_in_received_not_in_wished) == 0) { // no diff => mean everything is received
$status = CommandeFournisseur::STATUS_RECEIVED_COMPLETELY;
} elseif (!empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED)) {
// set totally received if more products received than ordered
$close = 0;
if (count($diff_array) > 0) {
// there are some difference between the two arrays
// scan the array of results
foreach ($diff_array as $key => $value) {
// if the quantity delivered is greater or equal to ordered quantity
if ($qty_received[$key] >= $qty_wished[$key]) {
$close++;
}
}
}
if ($close == count($diff_array)) {
// all the products are received equal or more than the ordered quantity
$status = CommandeFournisseur::STATUS_RECEIVED_COMPLETELY;
}
}
}
}
return $status;
}
/**
* Add an reception line.
@ -1115,7 +1213,7 @@ class Reception extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = 0, $max = 0, $short = 0, $notooltip = 0)
{
global $conf, $langs;
global $conf, $langs, $hookmanager;
$result = '';
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Reception").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
@ -1148,6 +1246,16 @@ class Reception extends CommonObject
$result .= ' ';
}
$result .= $linkstart.$this->ref.$linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -762,7 +762,7 @@ class RecruitmentCandidature extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('recruitmentcandidaturedao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -863,7 +863,7 @@ class RecruitmentJobPosition extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('recruitmentjobpositiondao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -933,7 +933,7 @@ class Dolresource extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{
global $conf, $langs;
global $conf, $langs, $hookmanager;
$result = '';
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Resource").'</u>';
@ -986,6 +986,15 @@ class Dolresource extends CommonObject
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -550,7 +550,7 @@ class Salary extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('salarypayment'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint;

View File

@ -2733,7 +2733,7 @@ class Societe extends CommonObject
$hookmanager->initHooks(array('thirdpartydao'));
$parameters = array(
'id'=>$this->id,
'getnomurl'=>$result,
'getnomurl' => &$result,
'withpicto '=> $withpicto,
'option'=> $option,
'maxlen'=> $maxlen,

View File

@ -13,7 +13,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -2470,7 +2470,7 @@ class SupplierProposal extends CommonObject
*/
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
{
global $langs, $conf, $user;
global $langs, $conf, $user, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@ -2553,7 +2553,15 @@ class SupplierProposal extends CommonObject
$result .= '</span>';
}
}
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;
} else {
$result .= $hookmanager->resPrint;
}
return $result;
}

View File

@ -189,7 +189,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
border<?php echo empty($conf->global->THEME_SHOW_BORDER_ON_INPUT) ? '-bottom' : ''; ?>: solid 1px var(--inputbordercolor);
/* padding: 5px; */
}
.pageplusone,
.pageplusone, .divadvancedsearchfieldcompinput,
div.tabBar input, div.tabBar input.flat, div.tabBar textarea, div.tabBar textarea.flat, div.tabBar form.flat select, div.tabBar select, div.tabBar select.flat, div.tabBar .dataTables_length label select
{
border<?php echo empty($conf->global->THEME_SHOW_BORDER_ON_INPUT) ? '-bottom' : ''; ?>: solid 1px var(--inputbordercolor);
@ -202,6 +202,11 @@ div.tabBar input, div.tabBar input.flat, div.tabBar textarea, div.tabBar textare
}
?>
}
.divadvancedsearchfieldcompinput {
background: #fff;
border-bottom: solid 1px var(--inputbordercolor);
border-radius: 3px;
}
input[name=duration_value], input[name=durationhour]
{
margin-right: 4px !important;
@ -269,7 +274,7 @@ section.setupsection {
div.tabBar textarea:focus {
border: 1px solid #aaa !important;
}
input:focus:not(.button):not(.select2-search__field):not(#top-bookmark-search-input), select:focus, .select2-container--open .select2-selection--single {
input:focus:not(.button):not(.select2-search__field):not(#top-bookmark-search-input):not(.search_component_input), select:focus, .select2-container--open .select2-selection--single {
/* div.tabBar input:focus, div.tabBar select:focus { */
border-bottom: 1px solid #666 !important;
border-bottom-left-radius: 0 !important;
@ -1032,10 +1037,11 @@ div.divsearchfield {
background: #fff;
padding-top: 3px;
padding-bottom: 3px;
padding-left: 10px;
padding-right: 10px;
padding-<?php echo $left; ?>: 0;
padding-<?php echo $right; ?>: 0;
border-bottom: solid 1px var(--inputbordercolor);
height: 24px;
border-radius: 3px;
}
.search_component_searchtext {
padding-top: 2px;
@ -1046,6 +1052,32 @@ div.divsearchfield {
margin: 0 !important;
padding: 3px;
}
.tagsearch {
padding: 2px;
padding-right: 4px;
padding-bottom: 3px;
background: #ddd;
border-radius: 4px;
}
.tagsearchdelete {
color: #999;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px;
padding-left: 4px;
}
.caretleftaxis {
margin-left: -13px;
margin-top: -1px;
position: absolute;
}
.caretdownaxis {
margin-left: -12px;
margin-top: 0;
position: absolute;
}
.a-filter, .a-mesure {
border-radius: 50px;
@ -5902,7 +5934,7 @@ input.select2-input {
color: #FFF !important;
}
.select2-container .select2-selection--multiple {
min-height: 30px !important;
min-height: 28px !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
margin-top: 5px !important;
@ -6015,6 +6047,9 @@ input.select2-input {
background-color: #ddd;
margin-top: 4px !important;
}
.select2-selection--multiple input.select2-search__field {
border-bottom: none !important;
}
.select2-search__field
{

View File

@ -623,12 +623,12 @@ td.amount, span.amount, div.amount, b.amount {
td.actionbuttons a {
padding-left: 6px;
}
select.flat, form.flat select, .pageplusone {
select.flat, form.flat select, .pageplusone, .divadvancedsearchfieldcompinput, {
font-weight: normal;
font-size: unset;
height: 2em;
}
input.pageplusone {
input.pageplusone, .divadvancedsearchfieldcompinput, {
padding-bottom: 4px;
padding-top: 4px;
}
@ -1155,6 +1155,59 @@ div.divsearchfield {
.divadvancedsearchfield span.select2.select2-container.select2-container--default {
padding-bottom: 4px;
}
.divadvancedsearchfieldcompinput {
background: #fff;
border-bottom: solid 1px var(--inputbordercolor);
}
.search_component_params {
/*display: flex; */
-webkit-flex-flow: row wrap;
flex-flow: row wrap;
background: #fff;
padding-top: 3px;
padding-bottom: 3px;
padding-<?php echo $left; ?>: 0;
padding-<?php echo $right; ?>: 0;
border-bottom: solid 1px var(--inputbordercolor);
height: 24px;
}
.search_component_searchtext {
padding-top: 2px;
}
.search_component_params_text, .search_component_params_text:focus {
border-bottom: none;
width: auto;
margin: 0 !important;
padding: 3px;
}
.tagsearch {
padding: 2px;
padding-right: 4px;
padding-bottom: 3px;
background: #ddd;
border-radius: 4px;
}
.tagsearchdelete {
color: #999;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px;
padding-left: 4px;
}
.caretleftaxis {
margin-left: -13px;
margin-top: -1px;
position: absolute;
}
.caretdownaxis {
margin-left: -12px;
margin-top: 0;
position: absolute;
}
<?php
// Add a nowrap on smartphone, so long list of field used for filter are overflowed with clip
if ($conf->browser->layout == 'phone') {
@ -5801,6 +5854,10 @@ input.select2-input {
color: #FFF !important;
}
.select2-container .select2-selection--multiple {
min-height: 28px !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
border: 1px solid #e4e4e4;
}
@ -5878,6 +5935,9 @@ input.select2-input {
border-right: none;
border-radius: 0 !important;
}
.select2-selection--multiple input.select2-search__field {
border-bottom: none !important;
}
.select2-search__field
{
outline: none;

View File

@ -709,7 +709,7 @@ class CTicketCategory extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('cticketcategorydao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -2756,7 +2756,7 @@ class User extends CommonObject
global $action;
$hookmanager->initHooks(array('userdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -785,7 +785,7 @@ class UserGroup extends CommonObject
global $action;
$hookmanager->initHooks(array('groupdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -814,7 +814,7 @@ class Workstation extends CommonObject
global $action, $hookmanager;
$hookmanager->initHooks(array('workstationdao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) {
$result = $hookmanager->resPrint;

View File

@ -565,7 +565,7 @@ class Hook extends CommonObject
$hookmanager->initHooks(array('hookdao'));
$parameters = array(
'id' => $this->id,
'getnomurl' => $result,
'getnomurl' => &$result,
);
// Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action);