2
0
forked from Wavyzz/dolibarr

Merge pull request #28886 from mdeweerd/fix/deprecatedfunccall

Fix Deprecated Function Calls
This commit is contained in:
Laurent Destailleur
2024-03-16 15:33:34 +01:00
committed by GitHub
15 changed files with 125 additions and 110 deletions

View File

@@ -68,7 +68,7 @@ return [
'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull'],
'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'],
'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'],
'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanTypeMismatchPropertyProbablyReal'],
'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchPropertyProbablyReal'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/intracommreport/list.php' => ['PhanAccessPropertyStaticAsNonStatic'],
@@ -79,8 +79,9 @@ return [
'htdocs/public/opensurvey/index.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/public/recruitment/index.php' => ['PhanPluginSuspiciousParamOrder'],
'htdocs/societe/paymentmodes.php' => ['PhanTypeMismatchPropertyProbablyReal'],
'htdocs/societe/paymentmodes.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchPropertyProbablyReal'],
'htdocs/societe/class/companybankaccount.class.php' => ['PhanParamSignatureMismatch'],
'htdocs/stripe/admin/stripe.php' => ['PhanDeprecatedFunction'],
'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/takepos/invoice.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/user/class/user.class.php' => ['PhanParamSignatureMismatch'],

View File

@@ -408,7 +408,7 @@ return [
'suppress_issue_types' => [
// Dolibarr uses a lot of internal deprecated stuff, not reporting
'PhanDeprecatedProperty',
'PhanDeprecatedFunction',
// 'PhanDeprecatedFunction',
//'PhanCompatibleNegativeStringOffset',
// 'PhanPluginDuplicateExpressionAssignment',
// Nulls are likely mostly false positives

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2020-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -98,6 +99,7 @@ $v->setPhoneNumber($object->fax, "TYPE=WORK;FAX");
$country = $object->country_code ? $object->country : '';
$v->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK;POSTAL");
// @phan-suppress-next-line PhanDeprecatedFunction (setLabel is the old method, new is setAddress)
$v->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK");
$v->setEmail($object->email);

View File

@@ -2424,7 +2424,7 @@ class Commande extends CommonOrder
/**
* Applique une remise relative
*
* @deprecated
* @deprecated Use setDiscount() instead.
* @see setDiscount()
* @param User $user User qui positionne la remise
* @param float $remise Discount (percent)
@@ -2435,6 +2435,7 @@ class Commande extends CommonOrder
{
// phpcs:enable
dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE);
// @phan-suppress-next-line PhanDeprecatedFunction
return $this->setDiscount($user, $remise, $notrigger);
}

View File

@@ -12,6 +12,7 @@
* Copyright (C) 2016-2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2023 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2021-2023 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1107,7 +1108,7 @@ if ($resql) {
// Payment term
if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) {
print '<td class="liste_titre">';
$form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1);
print '</td>';
}
// Payment mode

View File

@@ -4414,6 +4414,7 @@ class Facture extends CommonInvoice
{
// phpcs:enable
dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE);
// @phan-suppress-next-line PhanDeprecatedFunction
return $this->setDiscount($user, $remise, $notrigger);
}

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -67,6 +68,7 @@ $v->setPhoneNumber($contact->fax, "TYPE=WORK;FAX");
$country = $contact->country_code ? $contact->country : '';
$v->setAddress("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK;POSTAL");
// @phan-suppress-next-line PhanDeprecatedFunction setLabel applies the old method, setAddress is the new method.
$v->setLabel("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK");
$v->setEmail($contact->email);

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2023 Charlene BENKE <charlene@patas-monkey.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,10 +38,10 @@ require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
$langs->loadLangs(array('companies', 'contracts', 'tickets'));
$socid=GETPOSTINT('socid');
$id=GETPOSTINT('id');
$ref=GETPOST('ref', 'alpha');
$action=GETPOST('action', 'alpha');
$socid = GETPOSTINT('socid');
$id = GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'alpha');
if ($id == '' && $ref == '') {
dol_print_error(null, 'Bad parameter');
@@ -48,12 +49,12 @@ if ($id == '' && $ref == '') {
}
// Security check
$socid=0;
$socid = 0;
if ($user->socid > 0) {
$socid=$user->socid;
$socid = $user->socid;
}
$result=restrictedArea($user, 'contrat', $id);
$result = restrictedArea($user, 'contrat', $id);
/*
@@ -63,25 +64,25 @@ $result=restrictedArea($user, 'contrat', $id);
llxHeader("", $langs->trans("Tickets"), "Contrat");
$form = new Form($db);
$userstatic=new User($db);
$userstatic = new User($db);
$object= new Contrat($db);
$result=$object->fetch($id, $ref);
$ret=$object->fetch_thirdparty();
$object = new Contrat($db);
$result = $object->fetch($id, $ref);
$ret = $object->fetch_thirdparty();
$head = contract_prepare_head($object);
dol_fiche_head($head, 'ticket', $langs->trans("Contract"), -1, 'contract');
dol_get_fiche_head($head, 'ticket', $langs->trans("Contract"), -1, 'contract');
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid) ? '?socid='.$socid : '').'">';
$linkback.= $langs->trans("BackToList").'</a>';
$linkback .= $langs->trans("BackToList").'</a>';
$morehtmlref='';
$morehtmlref.=$object->ref;
$morehtmlref = '';
$morehtmlref .= $object->ref;
$morehtmlref.='<div class="refidno">';
$morehtmlref .= '<div class="refidno">';
// Ref customer
$morehtmlref.=$form->editfieldkey(
$morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer',
$object->ref_customer,
@@ -92,7 +93,7 @@ $morehtmlref.=$form->editfieldkey(
0,
1
);
$morehtmlref.=$form->editfieldval(
$morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_customer',
$object->ref_customer,
@@ -106,8 +107,8 @@ $morehtmlref.=$form->editfieldval(
1
);
// Ref supplier
$morehtmlref.='<br>';
$morehtmlref.=$form->editfieldkey(
$morehtmlref .= '<br>';
$morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier',
$object->ref_supplier,
@@ -118,7 +119,7 @@ $morehtmlref.=$form->editfieldkey(
0,
1
);
$morehtmlref.=$form->editfieldval(
$morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier',
$object->ref_supplier,
@@ -132,25 +133,25 @@ $morehtmlref.=$form->editfieldval(
1
);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
$morehtmlref .= '<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' : ';
$morehtmlref .= '<br>'.$langs->trans('Project') . ' : ';
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=';
$morehtmlref.=$object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id=';
$morehtmlref .= $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref .= $proj->ref;
$morehtmlref .= '</a>';
} else {
$morehtmlref.='';
$morehtmlref .= '';
}
}
$morehtmlref.='</div>';
$morehtmlref .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref);
@@ -161,7 +162,7 @@ print '<div class="underbanner clearboth"></div>';
* Referrers types
*/
$title=$langs->trans("ListTicketsLinkToContract");
$title = $langs->trans("ListTicketsLinkToContract");
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -88,7 +89,7 @@ abstract class CommonNumRefGenerator
*
* @param Translate $langs Object langs
* @return string Model name
* @deprecated
* @deprecated Use getName() instead
* @see getName()
*/
public function getNom($langs)

View File

@@ -4321,7 +4321,7 @@ class Form
* > 0 : force deposit percentage (for example, from company object)
* @param int $noprint if set to one we return the html to print, if 0 (default) we print it
* @return void|string
* @deprecated
* @deprecated Use getSelectConditionsPaiements() instead and handle noprint locally.
*/
public function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '', $deposit_percent = -1, $noprint = 0)
{

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2021 John BOTELLA <john.botella@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -154,15 +155,15 @@ class FormSetup
return $hookmanager->resPrint;
} else {
$out = '<!-- Start generateOutput from FormSetup class -->';
$out.= $this->htmlBeforeOutputForm;
$out .= $this->htmlBeforeOutputForm;
if ($editMode) {
$out.= '<form ' . self::generateAttributesStringFromArray($this->formAttributes) . ' >';
$out .= '<form ' . self::generateAttributesStringFromArray($this->formAttributes) . ' >';
// generate hidden values from $this->formHiddenInputs
if (!empty($this->formHiddenInputs) && is_array($this->formHiddenInputs)) {
foreach ($this->formHiddenInputs as $hiddenKey => $hiddenValue) {
$out.= '<input type="hidden" name="'.dol_escape_htmltag($hiddenKey).'" value="' . dol_escape_htmltag($hiddenValue) . '">';
$out .= '<input type="hidden" name="'.dol_escape_htmltag($hiddenKey).'" value="' . dol_escape_htmltag($hiddenValue) . '">';
}
}
}
@@ -180,7 +181,7 @@ class FormSetup
return $hookmanager->resPrint;
} elseif ($editMode) {
$out .= '<div class="form-setup-button-container center">'; // Todo : remove .center by adding style to form-setup-button-container css class in all themes
$out.= $this->htmlOutputMoreButton;
$out .= $this->htmlOutputMoreButton;
$out .= '<input class="button button-save" type="submit" value="' . $this->langs->trans("Save") . '">'; // Todo fix dolibarr style for <button and use <button instead of input
/*$out .= ' &nbsp;&nbsp; ';
$out .= '<a class="button button-cancel" type="submit" href="' . $this->formAttributes['action'] . '">'.$this->langs->trans('Cancel').'</a>';
@@ -192,7 +193,7 @@ class FormSetup
$out .= '</form>';
}
$out.= $this->htmlAfterOutputForm;
$out .= $this->htmlAfterOutputForm;
return $out;
}
@@ -311,27 +312,27 @@ class FormSetup
public function generateLineOutput($item, $editMode = false)
{
$out = '';
if ($item->enabled==1) {
if ($item->enabled == 1) {
$trClass = 'oddeven';
if ($item->getType() == 'title') {
$trClass = 'liste_titre';
}
$this->setupNotEmpty++;
$out.= '<tr class="'.$trClass.'">';
$out .= '<tr class="'.$trClass.'">';
$out.= '<td class="col-setup-title">';
$out.= '<span id="helplink'.$item->confKey.'" class="spanforparamtooltip">';
$out.= $this->form->textwithpicto($item->getNameText(), $item->getHelpText(), 1, 'info', '', 0, 3, 'tootips'.$item->confKey);
$out.= '</span>';
$out.= '</td>';
$out .= '<td class="col-setup-title">';
$out .= '<span id="helplink'.$item->confKey.'" class="spanforparamtooltip">';
$out .= $this->form->textwithpicto($item->getNameText(), $item->getHelpText(), 1, 'info', '', 0, 3, 'tootips'.$item->confKey);
$out .= '</span>';
$out .= '</td>';
$out.= '<td>';
$out .= '<td>';
if ($editMode) {
$out.= $item->generateInputField();
$out .= $item->generateInputField();
} else {
$out.= $item->generateOutputField();
$out .= $item->generateOutputField();
}
if (!empty($item->errors)) {
@@ -339,8 +340,8 @@ class FormSetup
setEventMessages(null, $item->errors, 'errors');
}
$out.= '</td>';
$out.= '</tr>';
$out .= '</td>';
$out .= '</tr>';
}
return $out;
@@ -393,6 +394,7 @@ class FormSetup
$item = new FormSetupItem($confKey);
// need to be ignored from scrutinizer setTypeFromTypeString was created as deprecated to incite developer to use object oriented usage
// @phan-suppress-next-line PhanDeprecatedFunction
/** @scrutinizer ignore-deprecated */ $item->setTypeFromTypeString($params['type']);
if (!empty($params['enabled'])) {
@@ -831,7 +833,9 @@ class FormSetupItem
$out = (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans('MissingTranslationForConfKey', $this->confKey));
// if conf defined on entity 0, prepend a picto to indicate it will apply across all entities
if (isModEnabled('multicompany') && $this->entity == 0) $out = img_picto($this->langs->trans('AllEntities'), 'fa-globe-americas em088 opacityhigh') . '&nbsp;' . $out;
if (isModEnabled('multicompany') && $this->entity == 0) {
$out = img_picto($this->langs->trans('AllEntities'), 'fa-globe-americas em088 opacityhigh') . '&nbsp;' . $out;
}
return $out;
}
@@ -866,51 +870,51 @@ class FormSetupItem
$out = '';
if ($this->type == 'title') {
$out.= $this->generateOutputField(); // title have no input
$out .= $this->generateOutputField(); // title have no input
} elseif ($this->type == 'multiselect') {
$out.= $this->generateInputFieldMultiSelect();
$out .= $this->generateInputFieldMultiSelect();
} elseif ($this->type == 'select') {
$out.= $this->generateInputFieldSelect();
$out .= $this->generateInputFieldSelect();
} elseif ($this->type == 'selectUser') {
$out.= $this->generateInputFieldSelectUser();
$out .= $this->generateInputFieldSelectUser();
} elseif ($this->type == 'textarea') {
$out.= $this->generateInputFieldTextarea();
} elseif ($this->type== 'html') {
$out.= $this->generateInputFieldHtml();
} elseif ($this->type== 'color') {
$out.= $this->generateInputFieldColor();
$out .= $this->generateInputFieldTextarea();
} elseif ($this->type == 'html') {
$out .= $this->generateInputFieldHtml();
} elseif ($this->type == 'color') {
$out .= $this->generateInputFieldColor();
} elseif ($this->type == 'yesno') {
if (!empty($conf->use_javascript_ajax)) {
$out.= ajax_constantonoff($this->confKey);
$out .= ajax_constantonoff($this->confKey);
} else {
$out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);
$out .= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);
}
} elseif (preg_match('/emailtemplate:/', $this->type)) {
$out.= $this->generateInputFieldEmailTemplate();
$out .= $this->generateInputFieldEmailTemplate();
} elseif (preg_match('/category:/', $this->type)) {
$out.=$this->generateInputFieldCategories();
$out .= $this->generateInputFieldCategories();
} elseif (preg_match('/thirdparty_type/', $this->type)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($this->db);
$out.= $formcompany->selectProspectCustomerType($this->fieldValue, $this->confKey);
$out .= $formcompany->selectProspectCustomerType($this->fieldValue, $this->confKey);
} elseif ($this->type == 'securekey') {
$out.= $this->generateInputFieldSecureKey();
$out .= $this->generateInputFieldSecureKey();
} elseif ($this->type == 'product') {
if (isModEnabled("product") || isModEnabled("service")) {
$selected = (empty($this->fieldValue) ? '' : $this->fieldValue);
$out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);
$out .= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);
}
} elseif ($this->type == 'selectBankAccount') {
if (isModEnabled("bank")) {
$selected = (empty($this->fieldValue) ? '' : $this->fieldValue);
$out.= $this->form->select_comptes($selected, $this->confKey, 0, '', 0, '', 0, '', 1);
$out .= $this->form->select_comptes($selected, $this->confKey, 0, '', 0, '', 0, '', 1);
}
} elseif ($this->type == 'password') {
$out.= $this->generateInputFieldPassword('dolibarr');
$out .= $this->generateInputFieldPassword('dolibarr');
} elseif ($this->type == 'genericpassword') {
$out.= $this->generateInputFieldPassword('generic');
$out .= $this->generateInputFieldPassword('generic');
} else {
$out.= $this->generateInputFieldText();
$out .= $this->generateInputFieldText();
}
return $out;
@@ -937,8 +941,8 @@ class FormSetupItem
public function generateInputFieldTextarea()
{
$out = '<textarea class="flat" name="'.$this->confKey.'" id="'.$this->confKey.'" cols="50" rows="5" wrap="soft">' . "\n";
$out.= dol_htmlentities($this->fieldValue);
$out.= "</textarea>\n";
$out .= dol_htmlentities($this->fieldValue);
$out .= "</textarea>\n";
return $out;
}
@@ -1021,7 +1025,7 @@ class FormSetupItem
global $conf;
$out = '<input required="required" type="text" class="flat" id="'.$this->confKey.'" name="'.$this->confKey.'" value="'.(GETPOST($this->confKey, 'alpha') ? GETPOST($this->confKey, 'alpha') : $this->fieldValue).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
$out.= '&nbsp;'.img_picto($this->langs->trans('Generate'), 'refresh', 'id="generate_token'.$this->confKey.'" class="linkobject"');
$out .= '&nbsp;'.img_picto($this->langs->trans('Generate'), 'refresh', 'id="generate_token'.$this->confKey.'" class="linkobject"');
}
// Add button to autosuggest a key
@@ -1167,25 +1171,25 @@ class FormSetupItem
if ($this->type == 'title') {
// nothing to do
} elseif ($this->type == 'textarea') {
$out.= dol_nl2br($this->fieldValue);
$out .= dol_nl2br($this->fieldValue);
} elseif ($this->type == 'multiselect') {
$out.= $this->generateOutputFieldMultiSelect();
$out .= $this->generateOutputFieldMultiSelect();
} elseif ($this->type == 'select') {
$out.= $this->generateOutputFieldSelect();
$out .= $this->generateOutputFieldSelect();
} elseif ($this->type == 'selectUser') {
$out.= $this->generateOutputFieldSelectUser();
$out .= $this->generateOutputFieldSelectUser();
} elseif ($this->type == 'html') {
$out.= $this->fieldValue;
$out .= $this->fieldValue;
} elseif ($this->type == 'color') {
$out.= $this->generateOutputFieldColor();
$out .= $this->generateOutputFieldColor();
} elseif ($this->type == 'yesno') {
if (!empty($conf->use_javascript_ajax)) {
$out.= ajax_constantonoff($this->confKey);
$out .= ajax_constantonoff($this->confKey);
} else {
if ($this->fieldValue == 1) {
$out.= $langs->trans('yes');
$out .= $langs->trans('yes');
} else {
$out.= $langs->trans('no');
$out .= $langs->trans('no');
}
}
} elseif (preg_match('/emailtemplate:/', $this->type)) {
@@ -1199,7 +1203,7 @@ class FormSetupItem
if (is_numeric($template) && $template < 0) {
$this->setErrors($formmail->errors);
}
$out.= $this->langs->trans($template->label);
$out .= $this->langs->trans($template->label);
}
} elseif (preg_match('/category:/', $this->type)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -1213,16 +1217,16 @@ class FormSetupItem
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
}
$out.='<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
$out .= '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
} elseif (preg_match('/thirdparty_type/', $this->type)) {
if ($this->fieldValue==2) {
$out.= $this->langs->trans("Prospect");
} elseif ($this->fieldValue==3) {
$out.= $this->langs->trans("ProspectCustomer");
} elseif ($this->fieldValue==1) {
$out.= $this->langs->trans("Customer");
} elseif ($this->fieldValue==0) {
$out.= $this->langs->trans("NorProspectNorCustomer");
if ($this->fieldValue == 2) {
$out .= $this->langs->trans("Prospect");
} elseif ($this->fieldValue == 3) {
$out .= $this->langs->trans("ProspectCustomer");
} elseif ($this->fieldValue == 1) {
$out .= $this->langs->trans("Customer");
} elseif ($this->fieldValue == 0) {
$out .= $this->langs->trans("NorProspectNorCustomer");
}
} elseif ($this->type == 'product') {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -1230,7 +1234,7 @@ class FormSetupItem
$product = new Product($this->db);
$resprod = $product->fetch($this->fieldValue);
if ($resprod > 0) {
$out.= $product->ref;
$out .= $product->ref;
} elseif ($resprod < 0) {
$this->setErrors($product->errors);
}
@@ -1240,14 +1244,14 @@ class FormSetupItem
$bankaccount = new Account($this->db);
$resbank = $bankaccount->fetch($this->fieldValue);
if ($resbank > 0) {
$out.= $bankaccount->label;
$out .= $bankaccount->label;
} elseif ($resbank < 0) {
$this->setErrors($bankaccount->errors);
}
} elseif ($this->type == 'password' || $this->type == 'genericpassword') {
$out.= str_repeat('*', strlen($this->fieldValue));
$out .= str_repeat('*', strlen($this->fieldValue));
} else {
$out.= $this->fieldValue;
$out .= $this->fieldValue;
}
return $out;
@@ -1270,7 +1274,7 @@ class FormSetupItem
if (!empty($TSelected)) {
foreach ($TSelected as $selected) {
if (!empty($this->fieldOptions[$selected])) {
$outPut.= dolGetBadge('', $this->fieldOptions[$selected], 'info').' ';
$outPut .= dolGetBadge('', $this->fieldOptions[$selected], 'info').' ';
}
}
}
@@ -1285,7 +1289,7 @@ class FormSetupItem
public function generateOutputFieldColor()
{
global $langs;
$this->fieldAttr['disabled']=null;
$this->fieldAttr['disabled'] = null;
$color = colorArrayToHex(colorStringToArray($this->fieldValue, array()), '');
if ($color) {
return '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
@@ -1299,7 +1303,7 @@ class FormSetupItem
*/
public function generateInputFieldColor()
{
$this->fieldAttr['type']= 'color';
$this->fieldAttr['type'] = 'color';
$default = $this->defaultFieldValue;
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$formother = new FormOther($this->db);

View File

@@ -90,7 +90,7 @@ abstract class ModeleNumRefBarCode extends CommonNumRefGenerator
$s .= $langs->trans("Name").': <b>'.$this->name.'</b><br>';
$s .= $langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
if ($type != -1) {
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getName($langs).'</b><br>';
}
$s .= '<br>';
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -125,7 +126,7 @@ abstract class ModeleProductCode extends CommonNumRefGenerator
}
$s = '';
if ($type == -1) {
$s .= $langs->trans("Name").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("Name").': <b>'.$this->getName($langs).'</b><br>';
$s .= $langs->trans("Version").': <b>'.$this->getVersion().'</b><br>';
} elseif ($type == 0) {
$s .= $langs->trans("ProductCodeDesc").'<br>';
@@ -133,7 +134,7 @@ abstract class ModeleProductCode extends CommonNumRefGenerator
$s .= $langs->trans("ServiceCodeDesc").'<br>';
}
if ($type != -1) {
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getName($langs).'</b><br>';
}
$s .= '<br>';
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';

View File

@@ -136,14 +136,14 @@ abstract class ModeleThirdPartyCode extends CommonNumRefGenerator
$s = '';
if ($type == -1) {
$s .= $langs->trans("Name").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("Name").': <b>'.$this->getName($langs).'</b><br>';
} elseif ($type == 0) {
$s .= $langs->trans("CustomerCodeDesc").'<br>';
} elseif ($type == 1) {
$s .= $langs->trans("SupplierCodeDesc").'<br>';
}
if ($type != -1) {
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getNom($langs).'</b><br>';
$s .= $langs->trans("ValidityControledByModule").': <b>'.$this->getName($langs).'</b><br>';
}
$s .= '<br>';
$s .= '<u>'.$langs->trans("ThisIsModuleRules").':</u><br>';

View File

@@ -247,7 +247,7 @@ $server->addPlugin($tempFF);
*/
// And off we go!
$server->exec();
$server->start();
if (is_object($db)) {
$db->close();