Passed
Push — GENERAL_BUG_REVIEW_240911 ( 776d89...c757bd )
by Rafael
50:33
created

ModeleNumRefMembers   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 30
dl 0
loc 58
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getNextValue() 0 3 1
A getToolTip() 0 37 4
1
<?php
2
3
/* Copyright (C) 2003-2005  Rodolphe Quiedeville        <[email protected]>
4
 * Copyright (C) 2004-2010  Laurent Destailleur         <[email protected]>
5
 * Copyright (C) 2004       Eric Seigne                 <[email protected]>
6
 * Copyright (C) 2005-2012  Regis Houssin               <[email protected]>
7
 * Copyright (C) 2024		Frédéric France			    <[email protected]>
8
 * Copyright (C) 2024       Rafael San José             <[email protected]>
9
 *
10
 * This program is free software; you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation; either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 * or see https://www.gnu.org/
23
 */
24
25
namespace Dolibarr\Code\Members\Classes;
26
27
use Dolibarr\Code\Adherents\Classes\Adherent;
28
use Dolibarr\Code\Core\Classes\CommonNumRefGenerator;
29
use Dolibarr\Code\Core\Classes\Translate;
30
use Dolibarr\Code\Societe\Classes\Societe;
31
32
/**
33
 *  \file       htdocs/core/modules/member/modules_member.class.php
34
 *  \ingroup    members
35
 *  \brief      File with parent class for generating members to PDF
36
 */
37
38
/**
39
 *  Class mere des modeles de numerotation des references de members
40
 */
41
abstract class ModeleNumRefMembers extends CommonNumRefGenerator
42
{
43
    /**
44
     *  Return description of module parameters
45
     *
46
     * @param Translate $langs Output language
47
     * @param Societe $soc Third party object
48
     * @return string                  HTML translated description
49
     */
50
    public function getToolTip($langs, $soc)
51
    {
52
        global $conf;
53
54
        $langs->loadLangs(array("admin", "companies"));
55
56
        $strikestart = '';
57
        $strikeend = '';
58
        if (getDolGlobalString('MAIN_MEMBER_CODE_ALWAYS_REQUIRED') && !empty($this->code_null)) {
59
            $strikestart = '<strike>';
60
            $strikeend = '</strike> ' . yn(1, 1, 2) . ' (' . $langs->trans("ForcedToByAModule", $langs->transnoentities("yes")) . ')';
61
        }
62
63
        $s = '';
64
        $s .= $langs->trans("Name") . ': <b>' . $this->getName($langs) . '</b><br>';
65
        $s .= $langs->trans("Version") . ': <b>' . $this->getVersion() . '</b><br>';
66
        $s .= $langs->trans("MemberCodeDesc") . '<br>';
67
        $s .= $langs->trans("ValidityControledByModule") . ': <b>' . $this->getName($langs) . '</b><br>';
68
        $s .= '<br>';
69
        $s .= '<u>' . $langs->trans("ThisIsModuleRules") . ':</u><br>';
70
71
        $s .= $langs->trans("Required") . ': ' . $strikestart;
72
        $s .= yn(!$this->code_null, 1, 2) . $strikeend;
73
        $s .= '<br>';
74
        $s .= $langs->trans("CanBeModifiedIfOk") . ': ';
75
        $s .= yn($this->code_modifiable, 1, 2);
76
        $s .= '<br>';
77
        $s .= $langs->trans("CanBeModifiedIfKo") . ': ' . yn($this->code_modifiable_invalide, 1, 2) . '<br>';
78
        $s .= $langs->trans("AutomaticCode") . ': ' . yn($this->code_auto, 1, 2) . '<br>';
79
        $s .= '<br>';
80
        $nextval = $this->getNextValue($soc, 0);
81
        if (empty($nextval)) {
82
            $nextval = $langs->trans("Undefined");
83
        }
84
        $s .= $langs->trans("NextValue") . ' (' . $langs->trans("Member") . '): <b>' . $nextval . '</b><br>';
85
86
        return $s;
87
    }
88
89
    /**
90
     *  Return next value
91
     *
92
     * @param Societe $objsoc Object third party
93
     * @param Adherent $object Object we need next value for
94
     * @return string                  next value
95
     */
96
    public function getNextValue($objsoc, $object)
97
    {
98
        return '';
99
    }
100
}
101