2
0
forked from Wavyzz/dolibarr

Merge branch 'develop' into feature/intervention_ext_download

This commit is contained in:
Laurent Destailleur
2022-10-24 19:48:19 +02:00
committed by GitHub
220 changed files with 2591 additions and 2253 deletions

View File

@@ -131,7 +131,12 @@ function bank_prepare_head(Account $object)
*/
function bank_admin_prepare_head($object)
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('bank_account');
$extrafields->fetch_name_optionals_label('bank');
$h = 0;
$head = array();
@@ -154,11 +159,19 @@ function bank_admin_prepare_head($object)
$head[$h][0] = DOL_URL_ROOT.'/admin/bank_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields").' ('.$langs->trans("BankAccounts").')';
$nbExtrafields = $extrafields->attributes['bank_account']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/bankline_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields").' ('.$langs->trans("BankTransactions").')';
$nbExtrafields = $extrafields->attributes['bank']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'bankline_extrafields';
$h++;

View File

@@ -139,7 +139,11 @@ function fichinter_prepare_head($object)
*/
function fichinter_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('fichinter');
$extrafields->fetch_name_optionals_label('fichinterdet');
$h = 0;
$head = array();
@@ -159,19 +163,25 @@ function fichinter_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinter_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$nbExtrafields = $extrafields->attributes['fichinter']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinterdet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['fichinterdet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributesdet';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'fichinter_admin', 'remove');
return $head;
return $head;
}
/**

View File

@@ -1160,26 +1160,26 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
/**
* Create a clone of instance of object (new instance with same value for properties)
* With native = 0: Property that are reference are also new object (full isolation clone). This means $this->db of new object is not valid.
* With native = 0: Property that are reference are also new object (full isolation clone). This means $this->db of new object may not be valid.
* With native = 1: Use PHP clone. Property that are reference are same pointer. This means $this->db of new object is still valid but point to same this->db than original object.
*
* @param object $object Object to clone
* @param int $native 0=Full isolation method, 1=Native PHP method
* @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method+destroy non scalar or array properties (recommended)
* @return object Clone object
* @see https://php.net/manual/language.oop5.cloning.php
*/
function dol_clone($object, $native = 0)
{
if (empty($native)) {
if ($native == 0) {
$tmpsavdb = null;
if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') {
$tmpsavdb = $object->db;
unset($object->db); // Such property can not be serialized when PgSql/Connection
unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection')
}
$myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields
if ($tmpsavdb) {
if (!empty($tmpsavdb)) {
$object->db = $tmpsavdb;
}
} else {
@@ -1233,6 +1233,7 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
$tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$tmp = preg_replace('/\-\-+/', '_', $tmp);
$tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp);
$tmp = preg_replace('/\s+\-$/', '', $tmp);
$tmp = str_replace('..', '', $tmp);
return $tmp;
}
@@ -1257,6 +1258,7 @@ function dol_sanitizePathName($str, $newstr = '_', $unaccent = 1)
$tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$tmp = preg_replace('/\-\-+/', '_', $tmp);
$tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp);
$tmp = preg_replace('/\s+\-$/', '', $tmp);
$tmp = str_replace('..', '', $tmp);
return $tmp;
}
@@ -1818,7 +1820,7 @@ function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0
* @param array $links Array of tabs. Note that label into $links[$i][1] must be already HTML escaped.
* @param string $active Active tab name
* @param string $title Title
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after), -3=-2+'noborderbottom'
* @param string $picto Add a picto on tab title
* @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto.
* @param string $morehtmlright Add more html content on right of tabs title
@@ -1992,8 +1994,8 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$out .= "</div>\n";
}
if (!$notab || $notab == -1 || $notab == -2) {
$out .= "\n".'<div class="tabBar'.($notab == -1 ? '' : ($notab == -2 ? ' tabBarNoTop' : ' tabBarWithBottom')).'">'."\n";
if (!$notab || $notab == -1 || $notab == -2 || $notab == -3) {
$out .= "\n".'<div class="tabBar'.($notab == -1 ? '' : ($notab == -2 ? ' tabBarNoTop' : (($notab == -3 ? ' noborderbottom' : '').' tabBarWithBottom'))).'">'."\n";
}
$parameters = array('tabname' => $active, 'out' => $out);
@@ -2300,13 +2302,13 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
// Add alias for thirdparty
if (!empty($object->name_alias)) {
$morehtmlref .= '<div class="refidno">'.$object->name_alias.'</div>';
$morehtmlref .= '<div class="refidno opacitymedium">'.$object->name_alias.'</div>';
}
// Add label
if (in_array($object->element, array('product', 'bank_account', 'project_task'))) {
if (!empty($object->label)) {
$morehtmlref .= '<div class="refidno">'.$object->label.'</div>';
$morehtmlref .= '<div class="refidno opacitymedium">'.$object->label.'</div>';
}
}
@@ -2321,7 +2323,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && ($conf->global->MAIN_SHOW_TECHNICAL_ID == '1' || preg_match('/'.preg_quote($object->element, '/').'/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && !empty($object->id)) {
$morehtmlref .= '<div style="clear: both;"></div>';
$morehtmlref .= '<div class="refidno">';
$morehtmlref .= '<div class="refidno opacitymedium">';
$morehtmlref .= $langs->trans("TechnicalID").': '.$object->id;
$morehtmlref .= '</div>';
}
@@ -2636,6 +2638,9 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$useadodb = getDolGlobalInt('MAIN_USE_LEGACY_ADODB_FOR_DATE', 0);
//$useadodb = 1; // To switch to adodb
if (!empty($useadodb)) {
include_once DOL_DOCUMENT_ROOT.'/includes/adodbtime/adodb-time.inc.php';
}
// Analyze date
$reg = array();
@@ -2665,8 +2670,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$dtts->setTimestamp($time);
$dtts->setTimezone($tzo);
$newformat = str_replace(
array('%Y', '%y', '%m', '%d', '%H', '%M', '%S', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'),
array('Y', 'y', 'm', 'd', 'H', 'i', 's', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'),
array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'),
array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'),
$format);
$ret = $dtts->format($newformat);
$ret = str_replace(
@@ -2691,8 +2696,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$dtts->setTimestamp($timetouse);
$dtts->setTimezone($tzo);
$newformat = str_replace(
array('%Y', '%y', '%m', '%d', '%H', '%M', '%S', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'),
array('Y', 'y', 'm', 'd', 'H', 'i', 's', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'),
array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'),
array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'),
$format);
$ret = $dtts->format($newformat);
$ret = str_replace(
@@ -8161,7 +8166,7 @@ function print_date_range($date_start, $date_end, $format = '', $outputlangs = '
*
* @param int $date_start Start date
* @param int $date_end End date
* @param string $format Output format
* @param string $format Output date format ('day', 'dayhour', ...)
* @param Translate $outputlangs Output language
* @param integer $withparenthesis 1=Add parenthesis, 0=no parenthesis
* @return string String

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2017 ATM-CONSULTING <contact@atm-consulting.fr>
*
@@ -137,7 +137,13 @@ function facture_prepare_head($object)
*/
function invoice_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user, $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('facture');
$extrafields->fetch_name_optionals_label('facturedet');
$extrafields->fetch_name_optionals_label('facture_rec');
$extrafields->fetch_name_optionals_label('facturedet_rec');
$h = 0;
$head = array();
@@ -160,25 +166,41 @@ function invoice_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_cust_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoices");
$nbExtrafields = $extrafields->attributes['facture']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$nbExtrafields = $extrafields->attributes['facturedet']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslines';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facture_rec_cust_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsCustomerInvoicesRec");
$nbExtrafields = $extrafields->attributes['facture_rec']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributesrec';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_rec_cust_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLinesRec");
$nbExtrafields = $extrafields->attributes['facturedet_rec']['count'];
if ($nbExtrafields > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
}
$head[$h][2] = 'attributeslinesrec';
$h++;
if ($conf->global->INVOICE_USE_SITUATION) { // Warning, implementation is seriously bugged and a new one not compatible is expected to become stable
if (!empty($conf->global->INVOICE_USE_SITUATION)) { // Warning, implementation is seriously bugged and a new one not compatible is expected to become stable
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
$head[$h][1] = $langs->trans("InvoiceSituation");
$head[$h][2] = 'situation';

View File

@@ -341,14 +341,14 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
$product_static->status_batch = $objp->product_tobatch;
$text = $product_static->getNomUrl(1);
$text .= ' - '.$label;
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($objp->description));
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description));
print $form->textwithtooltip($text, $description, 3, '', '', $i);
// Show range
print_date_range($objp->date_start, $objp->date_end);
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
print (!empty($objp->description) && $objp->description != $objp->product) ? '<br>'.dol_htmlentitiesbr($objp->description) : '';
}

View File

@@ -131,6 +131,21 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
} else {
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0');
}
} elseif ($type == 'fichinter') {
$securekeyseed = isset($conf->global->FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->FICHINTER_ONLINE_SIGNATURE_SECURITY_TOKEN : '';
$out = $urltouse.'/public/onlinesign/newonlinesign.php?source=fichinter&ref='.($mode ? '<span style="color: #666666">' : '');
if ($mode == 1) {
$out .= 'fichinter_ref';
}
if ($mode == 0) {
$out .= urlencode($ref);
}
$out .= ($mode ? '</span>' : '');
if ($mode == 1) {
$out .= "hash('".$securekeyseed."' + '".$type."' + fichinter_ref)";
} else {
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $object->entity), '0');
}
}
// For multicompany

View File

@@ -567,7 +567,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
}
}
// Set $out to sow events
// Set $out to show events
$out = '';
if (!isModEnabled('agenda')) {