Passed
Push — master ( 65bdac...4e88da )
by Alxarafe
32:38
created
dolibarr/htdocs/core/modules/reception/modules_reception.php 3 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  *  \brief      File that contains parent class for sending receipts models
23 23
  *              and parent class for sending receipts numbering models
24 24
  */
25
- require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
25
+    require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
26 26
 
27 27
 /**
28 28
  *	Parent class of sending receipts models
@@ -34,25 +34,25 @@  discard block
 block discarded – undo
34 34
 
35 35
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
36 36
     /**
37
-	 *  Return list of active generation modules
38
-	 *
37
+     *  Return list of active generation modules
38
+     *
39 39
      *  @param	DoliDB	$db     			Database handler
40 40
      *  @param  integer	$maxfilenamelength  Max length of value to show
41 41
      *  @return	array						List of templates
42
-	 */
43
-	static function liste_modeles($db,$maxfilenamelength=0)
44
-	{
45
-		// phpcs:enable
46
-		global $conf;
42
+     */
43
+    static function liste_modeles($db,$maxfilenamelength=0)
44
+    {
45
+        // phpcs:enable
46
+        global $conf;
47 47
 
48
-		$type='reception';
49
-		$liste=array();
48
+        $type='reception';
49
+        $liste=array();
50 50
 
51
-		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
52
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
51
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
52
+        $liste=getListOfModels($db,$type,$maxfilenamelength);
53 53
 
54
-		return $liste;
55
-	}
54
+        return $liste;
55
+    }
56 56
 }
57 57
 
58 58
 
@@ -61,78 +61,78 @@  discard block
 block discarded – undo
61 61
  */
62 62
 abstract class ModelNumRefReception
63 63
 {
64
-	var $error='';
65
-
66
-	/** Return if a model can be used or not
67
-	 *
68
-	 *  @return		boolean     true if model can be used
69
-	 */
70
-	function isEnabled()
71
-	{
72
-		return true;
73
-	}
74
-
75
-	/**
76
-	 *	Return default description of numbering model
77
-	 *
78
-	 *	@return     string      text description
79
-	 */
80
-	function info()
81
-	{
82
-		global $langs;
83
-		$langs->load("reception");
84
-		return $langs->trans("NoDescription");
85
-	}
86
-
87
-	/**
88
-	 *	Returns numbering example
89
-	 *
90
-	 *	@return     string      Example
91
-	 */
92
-	function getExample()
93
-	{
94
-		global $langs;
95
-		$langs->load("reception");
96
-		return $langs->trans("NoExample");
97
-	}
98
-
99
-	/**
100
-	 *	Test if existing numbers make problems with numbering
101
-	 *
102
-	 *	@return     boolean     false if conflit, true if ok
103
-	 */
104
-	function canBeActivated()
105
-	{
106
-		return true;
107
-	}
108
-
109
-	/**
110
-	 *	Returns next value assigned
111
-	 *
112
-	 *	@param	Societe		$objsoc     Third party object
113
-	 *	@param	Object		$shipment	Shipment object
114
-	 *	@return	string					Value
115
-	 */
116
-	function getNextValue($objsoc, $shipment)
117
-	{
118
-		global $langs;
119
-		return $langs->trans("NotAvailable");
120
-	}
121
-
122
-	/**
123
-	 *	Returns version of the numbering model
124
-	 *
125
-	 *	@return     string      Value
126
-	 */
127
-	function getVersion()
128
-	{
129
-		global $langs;
130
-		$langs->load("admin");
131
-
132
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
133
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
134
-		if ($this->version == 'dolibarr') return DOL_VERSION;
135
-		if ($this->version) return $this->version;
136
-		return $langs->trans("NotAvailable");
137
-	}
64
+    var $error='';
65
+
66
+    /** Return if a model can be used or not
67
+     *
68
+     *  @return		boolean     true if model can be used
69
+     */
70
+    function isEnabled()
71
+    {
72
+        return true;
73
+    }
74
+
75
+    /**
76
+     *	Return default description of numbering model
77
+     *
78
+     *	@return     string      text description
79
+     */
80
+    function info()
81
+    {
82
+        global $langs;
83
+        $langs->load("reception");
84
+        return $langs->trans("NoDescription");
85
+    }
86
+
87
+    /**
88
+     *	Returns numbering example
89
+     *
90
+     *	@return     string      Example
91
+     */
92
+    function getExample()
93
+    {
94
+        global $langs;
95
+        $langs->load("reception");
96
+        return $langs->trans("NoExample");
97
+    }
98
+
99
+    /**
100
+     *	Test if existing numbers make problems with numbering
101
+     *
102
+     *	@return     boolean     false if conflit, true if ok
103
+     */
104
+    function canBeActivated()
105
+    {
106
+        return true;
107
+    }
108
+
109
+    /**
110
+     *	Returns next value assigned
111
+     *
112
+     *	@param	Societe		$objsoc     Third party object
113
+     *	@param	Object		$shipment	Shipment object
114
+     *	@return	string					Value
115
+     */
116
+    function getNextValue($objsoc, $shipment)
117
+    {
118
+        global $langs;
119
+        return $langs->trans("NotAvailable");
120
+    }
121
+
122
+    /**
123
+     *	Returns version of the numbering model
124
+     *
125
+     *	@return     string      Value
126
+     */
127
+    function getVersion()
128
+    {
129
+        global $langs;
130
+        $langs->load("admin");
131
+
132
+        if ($this->version == 'development') return $langs->trans("VersionDevelopment");
133
+        if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
134
+        if ($this->version == 'dolibarr') return DOL_VERSION;
135
+        if ($this->version) return $this->version;
136
+        return $langs->trans("NotAvailable");
137
+    }
138 138
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  */
30 30
 abstract class ModelePdfReception extends CommonDocGenerator
31 31
 {
32
-    var $error='';
32
+    var $error = '';
33 33
 
34 34
 
35 35
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
      *  @param  integer	$maxfilenamelength  Max length of value to show
41 41
      *  @return	array						List of templates
42 42
 	 */
43
-	static function liste_modeles($db,$maxfilenamelength=0)
43
+	static function liste_modeles($db, $maxfilenamelength = 0)
44 44
 	{
45 45
 		// phpcs:enable
46 46
 		global $conf;
47 47
 
48
-		$type='reception';
49
-		$liste=array();
48
+		$type = 'reception';
49
+		$liste = array();
50 50
 
51 51
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
52
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
52
+		$liste = getListOfModels($db, $type, $maxfilenamelength);
53 53
 
54 54
 		return $liste;
55 55
 	}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
  */
62 62
 abstract class ModelNumRefReception
63 63
 {
64
-	var $error='';
64
+	var $error = '';
65 65
 
66 66
 	/** Return if a model can be used or not
67 67
 	 *
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -142,10 +142,18 @@
 block discarded – undo
142 142
 		global $langs;
143 143
 		$langs->load("admin");
144 144
 
145
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
146
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
147
-		if ($this->version == 'dolibarr') return DOL_VERSION;
148
-		if ($this->version) return $this->version;
145
+		if ($this->version == 'development') {
146
+		    return $langs->trans("VersionDevelopment");
147
+		}
148
+		if ($this->version == 'experimental') {
149
+		    return $langs->trans("VersionExperimental");
150
+		}
151
+		if ($this->version == 'dolibarr') {
152
+		    return DOL_VERSION;
153
+		}
154
+		if ($this->version) {
155
+		    return $this->version;
156
+		}
149 157
 		return $langs->trans("NotAvailable");
150 158
 	}
151 159
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/reception/mod_reception_moonstone.php 2 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -29,109 +29,109 @@
 block discarded – undo
29 29
  */
30 30
 class mod_reception_moonstone extends ModelNumRefReception
31 31
 {
32
-	var $version='dolibarr';
33
-	var $error = '';
34
-	var $nom = 'Moonstone';
35
-
36
-	/**
37
-	 *	Return default description of numbering model
38
-	 *
39
-	 *	@return     string      text description
40
-	 */
41
-	function info()
32
+    var $version='dolibarr';
33
+    var $error = '';
34
+    var $nom = 'Moonstone';
35
+
36
+    /**
37
+     *	Return default description of numbering model
38
+     *
39
+     *	@return     string      text description
40
+     */
41
+    function info()
42 42
     {
43
-    	global $conf,$langs;
43
+        global $conf,$langs;
44 44
 
45
-		$langs->load("bills");
45
+        $langs->load("bills");
46 46
 
47
-		$form = new Form($this->db);
47
+        $form = new Form($this->db);
48 48
 
49
-		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
50
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
51
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
52
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
53
-		$texte.= '<input type="hidden" name="maskconstreception" value="RECEPTION_MOONSTONE_MASK">';
54
-		$texte.= '<table class="nobordernopadding" width="100%">';
49
+        $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
50
+        $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
51
+        $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
52
+        $texte.= '<input type="hidden" name="action" value="updateMask">';
53
+        $texte.= '<input type="hidden" name="maskconstreception" value="RECEPTION_MOONSTONE_MASK">';
54
+        $texte.= '<table class="nobordernopadding" width="100%">';
55 55
 
56
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Reception"),$langs->transnoentities("Reception"));
57
-		$tooltip.=$langs->trans("GenericMaskCodes2");
58
-		$tooltip.=$langs->trans("GenericMaskCodes3");
59
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Reception"),$langs->transnoentities("Reception"));
60
-		$tooltip.=$langs->trans("GenericMaskCodes5");
56
+        $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Reception"),$langs->transnoentities("Reception"));
57
+        $tooltip.=$langs->trans("GenericMaskCodes2");
58
+        $tooltip.=$langs->trans("GenericMaskCodes3");
59
+        $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Reception"),$langs->transnoentities("Reception"));
60
+        $tooltip.=$langs->trans("GenericMaskCodes5");
61 61
 
62
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
63
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskreception" value="'.$conf->global->RECEPTION_MOONSTONE_MASK.'">',$tooltip,1,1).'</td>';
64
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
65
-		$texte.= '</tr>';
66
-		$texte.= '</table>';
67
-		$texte.= '</form>';
62
+        $texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
63
+        $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskreception" value="'.$conf->global->RECEPTION_MOONSTONE_MASK.'">',$tooltip,1,1).'</td>';
64
+        $texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
65
+        $texte.= '</tr>';
66
+        $texte.= '</table>';
67
+        $texte.= '</form>';
68 68
 
69
-		return $texte;
69
+        return $texte;
70 70
     }
71 71
 
72
-	/**
73
-	 *	Return numbering example
74
-	 *
75
-	 *	@return     string      Example
76
-	 */
72
+    /**
73
+     *	Return numbering example
74
+     *
75
+     *	@return     string      Example
76
+     */
77 77
     function getExample()
78 78
     {
79
-     	global $conf,$langs,$mysoc;
80
-
81
-    	$old_code_client=$mysoc->code_client;
82
-    	$old_code_type=$mysoc->typent_code;
83
-    	$mysoc->code_client='CCCCCCCCCC';
84
-    	$mysoc->typent_code='TTTTTTTTTT';
85
-     	$numExample = $this->getNextValue($mysoc,'');
86
-		$mysoc->code_client=$old_code_client;
87
-		$mysoc->typent_code=$old_code_type;
88
-
89
-		if (! $numExample)
90
-		{
91
-			$numExample = $langs->trans('NotConfigured');
92
-		}
93
-		return $numExample;
79
+            global $conf,$langs,$mysoc;
80
+
81
+        $old_code_client=$mysoc->code_client;
82
+        $old_code_type=$mysoc->typent_code;
83
+        $mysoc->code_client='CCCCCCCCCC';
84
+        $mysoc->typent_code='TTTTTTTTTT';
85
+            $numExample = $this->getNextValue($mysoc,'');
86
+        $mysoc->code_client=$old_code_client;
87
+        $mysoc->typent_code=$old_code_type;
88
+
89
+        if (! $numExample)
90
+        {
91
+            $numExample = $langs->trans('NotConfigured');
92
+        }
93
+        return $numExample;
94 94
     }
95 95
 
96
-	/**
97
-	 *	Return next value
98
-	 *
99
-	 *	@param	Societe		$objsoc     Third party object
100
-	 *	@param	Object		$reception	Reception object
101
-	 *	@return string      			Value if OK, 0 if KO
102
-	 */
96
+    /**
97
+     *	Return next value
98
+     *
99
+     *	@param	Societe		$objsoc     Third party object
100
+     *	@param	Object		$reception	Reception object
101
+     *	@return string      			Value if OK, 0 if KO
102
+     */
103 103
     function getNextValue($objsoc,$reception)
104 104
     {
105
-		global $db,$conf;
106
-
107
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
108
-
109
-		$mask=$conf->global->RECEPTION_MOONSTONE_MASK;
110
-
111
-		if (! $mask)
112
-		{
113
-			$this->error='NotConfigured';
114
-			return 0;
115
-		}
116
-
117
-		$date = $reception->date_reception;
118
-
119
-		$numFinal=get_next_value($db,$mask,'reception','ref','',$objsoc,$date);
120
-
121
-		return  $numFinal;
122
-	}
123
-
124
-	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
125
-	/**
126
-	 *  Return next free value
127
-	 *
128
-	 *	@param	Societe		$objsoc     Third party object
129
-	 *	@param	Object		$objforref	Reception object
130
-	 *	@return string      			Next free value
131
-	 */
132
-	function reception_get_num($objsoc,$objforref)
133
-	{
134
-		// phpcs:enable
135
-		return $this->getNextValue($objsoc,$objforref);
136
-	}
105
+        global $db,$conf;
106
+
107
+        require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
108
+
109
+        $mask=$conf->global->RECEPTION_MOONSTONE_MASK;
110
+
111
+        if (! $mask)
112
+        {
113
+            $this->error='NotConfigured';
114
+            return 0;
115
+        }
116
+
117
+        $date = $reception->date_reception;
118
+
119
+        $numFinal=get_next_value($db,$mask,'reception','ref','',$objsoc,$date);
120
+
121
+        return  $numFinal;
122
+    }
123
+
124
+    // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
125
+    /**
126
+     *  Return next free value
127
+     *
128
+     *	@param	Societe		$objsoc     Third party object
129
+     *	@param	Object		$objforref	Reception object
130
+     *	@return string      			Next free value
131
+     */
132
+    function reception_get_num($objsoc,$objforref)
133
+    {
134
+        // phpcs:enable
135
+        return $this->getNextValue($objsoc,$objforref);
136
+    }
137 137
 }
138 138
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
  *  \brief      File of class to manage reception numbering rules Moonstone
23 23
  */
24 24
 
25
-require_once DOL_DOCUMENT_ROOT .'/core/modules/reception/modules_reception.php';
25
+require_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php';
26 26
 
27 27
 /**
28 28
  *	Class to manage reception numbering rules Moonstone
29 29
  */
30 30
 class mod_reception_moonstone extends ModelNumRefReception
31 31
 {
32
-	var $version='dolibarr';
32
+	var $version = 'dolibarr';
33 33
 	var $error = '';
34 34
 	var $nom = 'Moonstone';
35 35
 
@@ -40,31 +40,31 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	function info()
42 42
     {
43
-    	global $conf,$langs;
43
+    	global $conf, $langs;
44 44
 
45 45
 		$langs->load("bills");
46 46
 
47 47
 		$form = new Form($this->db);
48 48
 
49 49
 		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
50
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
51
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
52
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
53
-		$texte.= '<input type="hidden" name="maskconstreception" value="RECEPTION_MOONSTONE_MASK">';
54
-		$texte.= '<table class="nobordernopadding" width="100%">';
55
-
56
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Reception"),$langs->transnoentities("Reception"));
57
-		$tooltip.=$langs->trans("GenericMaskCodes2");
58
-		$tooltip.=$langs->trans("GenericMaskCodes3");
59
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Reception"),$langs->transnoentities("Reception"));
60
-		$tooltip.=$langs->trans("GenericMaskCodes5");
61
-
62
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
63
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskreception" value="'.$conf->global->RECEPTION_MOONSTONE_MASK.'">',$tooltip,1,1).'</td>';
64
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
65
-		$texte.= '</tr>';
66
-		$texte.= '</table>';
67
-		$texte.= '</form>';
50
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
51
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
52
+		$texte .= '<input type="hidden" name="action" value="updateMask">';
53
+		$texte .= '<input type="hidden" name="maskconstreception" value="RECEPTION_MOONSTONE_MASK">';
54
+		$texte .= '<table class="nobordernopadding" width="100%">';
55
+
56
+		$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Reception"), $langs->transnoentities("Reception"));
57
+		$tooltip .= $langs->trans("GenericMaskCodes2");
58
+		$tooltip .= $langs->trans("GenericMaskCodes3");
59
+		$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Reception"), $langs->transnoentities("Reception"));
60
+		$tooltip .= $langs->trans("GenericMaskCodes5");
61
+
62
+		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
63
+		$texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskreception" value="'.$conf->global->RECEPTION_MOONSTONE_MASK.'">', $tooltip, 1, 1).'</td>';
64
+		$texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
65
+		$texte .= '</tr>';
66
+		$texte .= '</table>';
67
+		$texte .= '</form>';
68 68
 
69 69
 		return $texte;
70 70
     }
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
     function getExample()
78 78
     {
79
-     	global $conf,$langs,$mysoc;
79
+     	global $conf, $langs, $mysoc;
80 80
 
81
-    	$old_code_client=$mysoc->code_client;
82
-    	$old_code_type=$mysoc->typent_code;
83
-    	$mysoc->code_client='CCCCCCCCCC';
84
-    	$mysoc->typent_code='TTTTTTTTTT';
85
-     	$numExample = $this->getNextValue($mysoc,'');
86
-		$mysoc->code_client=$old_code_client;
87
-		$mysoc->typent_code=$old_code_type;
81
+    	$old_code_client = $mysoc->code_client;
82
+    	$old_code_type = $mysoc->typent_code;
83
+    	$mysoc->code_client = 'CCCCCCCCCC';
84
+    	$mysoc->typent_code = 'TTTTTTTTTT';
85
+     	$numExample = $this->getNextValue($mysoc, '');
86
+		$mysoc->code_client = $old_code_client;
87
+		$mysoc->typent_code = $old_code_type;
88 88
 
89
-		if (! $numExample)
89
+		if (!$numExample)
90 90
 		{
91 91
 			$numExample = $langs->trans('NotConfigured');
92 92
 		}
@@ -100,23 +100,23 @@  discard block
 block discarded – undo
100 100
 	 *	@param	Object		$reception	Reception object
101 101
 	 *	@return string      			Value if OK, 0 if KO
102 102
 	 */
103
-    function getNextValue($objsoc,$reception)
103
+    function getNextValue($objsoc, $reception)
104 104
     {
105
-		global $db,$conf;
105
+		global $db, $conf;
106 106
 
107
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
107
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
108 108
 
109
-		$mask=$conf->global->RECEPTION_MOONSTONE_MASK;
109
+		$mask = $conf->global->RECEPTION_MOONSTONE_MASK;
110 110
 
111
-		if (! $mask)
111
+		if (!$mask)
112 112
 		{
113
-			$this->error='NotConfigured';
113
+			$this->error = 'NotConfigured';
114 114
 			return 0;
115 115
 		}
116 116
 
117 117
 		$date = $reception->date_reception;
118 118
 
119
-		$numFinal=get_next_value($db,$mask,'reception','ref','',$objsoc,$date);
119
+		$numFinal = get_next_value($db, $mask, 'reception', 'ref', '', $objsoc, $date);
120 120
 
121 121
 		return  $numFinal;
122 122
 	}
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	 *	@param	Object		$objforref	Reception object
130 130
 	 *	@return string      			Next free value
131 131
 	 */
132
-	function reception_get_num($objsoc,$objforref)
132
+	function reception_get_num($objsoc, $objforref)
133 133
 	{
134 134
 		// phpcs:enable
135
-		return $this->getNextValue($objsoc,$objforref);
135
+		return $this->getNextValue($objsoc, $objforref);
136 136
 	}
137 137
 }
138 138
\ No newline at end of file
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/payment/mod_payment_ant.php 2 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -30,28 +30,28 @@  discard block
 block discarded – undo
30 30
  */
31 31
 class mod_payment_ant extends ModeleNumRefPayments
32 32
 {
33
-	/**
33
+    /**
34 34
      * Dolibarr version of the loaded document
35 35
      * @public string
36 36
      */
37
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
37
+    public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
38 38
 
39
-	/**
40
-	 * @var string Error message
41
-	 */
42
-	public $error = '';
39
+    /**
40
+     * @var string Error message
41
+     */
42
+    public $error = '';
43 43
 
44
-	/**
45
-	 * @var string Nom du modele
46
-	 * @deprecated
47
-	 * @see name
48
-	 */
49
-	public $nom='Ant';
44
+    /**
45
+     * @var string Nom du modele
46
+     * @deprecated
47
+     * @see name
48
+     */
49
+    public $nom='Ant';
50 50
 
51
-	/**
52
-	 * @var string model name
53
-	 */
54
-	public $name='Ant';
51
+    /**
52
+     * @var string model name
53
+     */
54
+    public $name='Ant';
55 55
 
56 56
 
57 57
     /**
@@ -59,39 +59,39 @@  discard block
 block discarded – undo
59 59
      *
60 60
      *  @return     string      Texte descripif
61 61
      */
62
-	function info()
62
+    function info()
63 63
     {
64
-    	global $conf, $langs;
64
+        global $conf, $langs;
65 65
 
66
-		$langs->load("bills");
66
+        $langs->load("bills");
67 67
 
68
-		$form = new Form($this->db);
68
+        $form = new Form($this->db);
69 69
 
70
-		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
71
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
72
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
73
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
74
-		$texte.= '<input type="hidden" name="maskconstpayment" value="PAYMENT_ANT_MASK">';
75
-		$texte.= '<table class="nobordernopadding" width="100%">';
70
+        $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
71
+        $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
72
+        $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
73
+        $texte.= '<input type="hidden" name="action" value="updateMask">';
74
+        $texte.= '<input type="hidden" name="maskconstpayment" value="PAYMENT_ANT_MASK">';
75
+        $texte.= '<table class="nobordernopadding" width="100%">';
76 76
 
77
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
78
-		$tooltip.=$langs->trans("GenericMaskCodes2");
79
-		$tooltip.=$langs->trans("GenericMaskCodes3");
80
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
81
-		$tooltip.=$langs->trans("GenericMaskCodes5");
77
+        $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
78
+        $tooltip.=$langs->trans("GenericMaskCodes2");
79
+        $tooltip.=$langs->trans("GenericMaskCodes3");
80
+        $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
81
+        $tooltip.=$langs->trans("GenericMaskCodes5");
82 82
 
83
-		// Parametrage du prefix
84
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
85
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskpayment" value="'.$conf->global->PAYMENT_ANT_MASK.'">',$tooltip,1,1).'</td>';
83
+        // Parametrage du prefix
84
+        $texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
85
+        $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskpayment" value="'.$conf->global->PAYMENT_ANT_MASK.'">',$tooltip,1,1).'</td>';
86 86
 
87
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
87
+        $texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
88 88
 
89
-		$texte.= '</tr>';
89
+        $texte.= '</tr>';
90 90
 
91
-		$texte.= '</table>';
92
-		$texte.= '</form>';
91
+        $texte.= '</table>';
92
+        $texte.= '</form>';
93 93
 
94
-		return $texte;
94
+        return $texte;
95 95
     }
96 96
 
97 97
     /**
@@ -101,55 +101,55 @@  discard block
 block discarded – undo
101 101
      */
102 102
     function getExample()
103 103
     {
104
-     	global $conf,$langs,$mysoc;
105
-
106
-    	$old_code_client=$mysoc->code_client;
107
-    	$mysoc->code_client='CCCCCCCCCC';
108
-     	$numExample = $this->getNextValue($mysoc,'');
109
-		$mysoc->code_client=$old_code_client;
110
-
111
-		if (! $numExample)
112
-		{
113
-			$numExample = $langs->trans('NotConfigured');
114
-		}
115
-		return $numExample;
104
+            global $conf,$langs,$mysoc;
105
+
106
+        $old_code_client=$mysoc->code_client;
107
+        $mysoc->code_client='CCCCCCCCCC';
108
+            $numExample = $this->getNextValue($mysoc,'');
109
+        $mysoc->code_client=$old_code_client;
110
+
111
+        if (! $numExample)
112
+        {
113
+            $numExample = $langs->trans('NotConfigured');
114
+        }
115
+        return $numExample;
116 116
     }
117 117
 
118
-	/**
119
-	 * 	Return next free value
120
-	 *
121
-	 *  @param	Societe		$objsoc     Object thirdparty
122
-	 *  @param  Object		$object		Object we need next value for
123
-	 *  @return string      			Value if KO, <0 if KO
124
-	 */
118
+    /**
119
+     * 	Return next free value
120
+     *
121
+     *  @param	Societe		$objsoc     Object thirdparty
122
+     *  @param  Object		$object		Object we need next value for
123
+     *  @return string      			Value if KO, <0 if KO
124
+     */
125 125
     function getNextValue($objsoc,$object)
126 126
     {
127
-		global $db,$conf;
127
+        global $db,$conf;
128 128
 
129
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
129
+        require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
130 130
 
131
-		// We get cursor rule
132
-		$mask=$conf->global->PAYMENT_ANT_MASK;
131
+        // We get cursor rule
132
+        $mask=$conf->global->PAYMENT_ANT_MASK;
133 133
 
134
-		if (! $mask)
135
-		{
136
-			$this->error='NotConfigured';
137
-			return 0;
138
-		}
134
+        if (! $mask)
135
+        {
136
+            $this->error='NotConfigured';
137
+            return 0;
138
+        }
139 139
 
140
-		$numFinal=get_next_value($db,$mask,'paiement','ref','',$objsoc,$object->datepaye);
140
+        $numFinal=get_next_value($db,$mask,'paiement','ref','',$objsoc,$object->datepaye);
141 141
 
142
-		return  $numFinal;
143
-	}
142
+        return  $numFinal;
143
+    }
144 144
 
145 145
 
146 146
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
147
-	/**
148
-	 *  Return next free value
149
-	 *
150
-	 *  @param	Societe		$objsoc     Object third party
151
-	 * 	@param	string		$objforref	Object for number to search
152
-	 *  @return string      			Next free value
147
+    /**
148
+     *  Return next free value
149
+     *
150
+     *  @param	Societe		$objsoc     Object third party
151
+     * 	@param	string		$objforref	Object for number to search
152
+     *  @return string      			Next free value
153 153
      */
154 154
     function commande_get_num($objsoc,$objforref)
155 155
     {
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * \brief      File containing class for numbering module Ant
23 23
  */
24 24
 
25
-require_once DOL_DOCUMENT_ROOT .'/core/modules/payment/modules_payment.php';
25
+require_once DOL_DOCUMENT_ROOT.'/core/modules/payment/modules_payment.php';
26 26
 
27 27
 
28 28
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      * Dolibarr version of the loaded document
35 35
      * @public string
36 36
      */
37
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
37
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
38 38
 
39 39
 	/**
40 40
 	 * @var string Error message
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
 	 * @deprecated
47 47
 	 * @see name
48 48
 	 */
49
-	public $nom='Ant';
49
+	public $nom = 'Ant';
50 50
 
51 51
 	/**
52 52
 	 * @var string model name
53 53
 	 */
54
-	public $name='Ant';
54
+	public $name = 'Ant';
55 55
 
56 56
 
57 57
     /**
@@ -68,28 +68,28 @@  discard block
 block discarded – undo
68 68
 		$form = new Form($this->db);
69 69
 
70 70
 		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
71
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
72
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
73
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
74
-		$texte.= '<input type="hidden" name="maskconstpayment" value="PAYMENT_ANT_MASK">';
75
-		$texte.= '<table class="nobordernopadding" width="100%">';
76
-
77
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
78
-		$tooltip.=$langs->trans("GenericMaskCodes2");
79
-		$tooltip.=$langs->trans("GenericMaskCodes3");
80
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
81
-		$tooltip.=$langs->trans("GenericMaskCodes5");
71
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
72
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
73
+		$texte .= '<input type="hidden" name="action" value="updateMask">';
74
+		$texte .= '<input type="hidden" name="maskconstpayment" value="PAYMENT_ANT_MASK">';
75
+		$texte .= '<table class="nobordernopadding" width="100%">';
76
+
77
+		$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Order"), $langs->transnoentities("Order"));
78
+		$tooltip .= $langs->trans("GenericMaskCodes2");
79
+		$tooltip .= $langs->trans("GenericMaskCodes3");
80
+		$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Order"), $langs->transnoentities("Order"));
81
+		$tooltip .= $langs->trans("GenericMaskCodes5");
82 82
 
83 83
 		// Parametrage du prefix
84
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
85
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskpayment" value="'.$conf->global->PAYMENT_ANT_MASK.'">',$tooltip,1,1).'</td>';
84
+		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
85
+		$texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskpayment" value="'.$conf->global->PAYMENT_ANT_MASK.'">', $tooltip, 1, 1).'</td>';
86 86
 
87
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
87
+		$texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
88 88
 
89
-		$texte.= '</tr>';
89
+		$texte .= '</tr>';
90 90
 
91
-		$texte.= '</table>';
92
-		$texte.= '</form>';
91
+		$texte .= '</table>';
92
+		$texte .= '</form>';
93 93
 
94 94
 		return $texte;
95 95
     }
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
      */
102 102
     function getExample()
103 103
     {
104
-     	global $conf,$langs,$mysoc;
104
+     	global $conf, $langs, $mysoc;
105 105
 
106
-    	$old_code_client=$mysoc->code_client;
107
-    	$mysoc->code_client='CCCCCCCCCC';
108
-     	$numExample = $this->getNextValue($mysoc,'');
109
-		$mysoc->code_client=$old_code_client;
106
+    	$old_code_client = $mysoc->code_client;
107
+    	$mysoc->code_client = 'CCCCCCCCCC';
108
+     	$numExample = $this->getNextValue($mysoc, '');
109
+		$mysoc->code_client = $old_code_client;
110 110
 
111
-		if (! $numExample)
111
+		if (!$numExample)
112 112
 		{
113 113
 			$numExample = $langs->trans('NotConfigured');
114 114
 		}
@@ -122,22 +122,22 @@  discard block
 block discarded – undo
122 122
 	 *  @param  Object		$object		Object we need next value for
123 123
 	 *  @return string      			Value if KO, <0 if KO
124 124
 	 */
125
-    function getNextValue($objsoc,$object)
125
+    function getNextValue($objsoc, $object)
126 126
     {
127
-		global $db,$conf;
127
+		global $db, $conf;
128 128
 
129
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
129
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
130 130
 
131 131
 		// We get cursor rule
132
-		$mask=$conf->global->PAYMENT_ANT_MASK;
132
+		$mask = $conf->global->PAYMENT_ANT_MASK;
133 133
 
134
-		if (! $mask)
134
+		if (!$mask)
135 135
 		{
136
-			$this->error='NotConfigured';
136
+			$this->error = 'NotConfigured';
137 137
 			return 0;
138 138
 		}
139 139
 
140
-		$numFinal=get_next_value($db,$mask,'paiement','ref','',$objsoc,$object->datepaye);
140
+		$numFinal = get_next_value($db, $mask, 'paiement', 'ref', '', $objsoc, $object->datepaye);
141 141
 
142 142
 		return  $numFinal;
143 143
 	}
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	 * 	@param	string		$objforref	Object for number to search
152 152
 	 *  @return string      			Next free value
153 153
      */
154
-    function commande_get_num($objsoc,$objforref)
154
+    function commande_get_num($objsoc, $objforref)
155 155
     {
156 156
         // phpcs:enable
157
-        return $this->getNextValue($objsoc,$objforref);
157
+        return $this->getNextValue($objsoc, $objforref);
158 158
     }
159 159
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/payment/mod_payment_cicada.php 3 patches
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -29,30 +29,30 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class mod_payment_cicada extends ModeleNumRefPayments
31 31
 {
32
-	/**
32
+    /**
33 33
      * Dolibarr version of the loaded document
34 34
      * @public string
35 35
      */
36
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
36
+    public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
37 37
 
38
-	public $prefix='PAY';
38
+    public $prefix='PAY';
39 39
 
40
-	/**
41
-	 * @var string Error code (or message)
42
-	 */
43
-	public $error='';
40
+    /**
41
+     * @var string Error code (or message)
42
+     */
43
+    public $error='';
44 44
 
45
-	/**
46
-	 * @var string Nom du modele
47
-	 * @deprecated
48
-	 * @see name
49
-	 */
50
-	public $nom='Cicada';
45
+    /**
46
+     * @var string Nom du modele
47
+     * @deprecated
48
+     * @see name
49
+     */
50
+    public $nom='Cicada';
51 51
 
52
-	/**
53
-	 * @var string model name
54
-	 */
55
-	public $name='Cicada';
52
+    /**
53
+     * @var string model name
54
+     */
55
+    public $name='Cicada';
56 56
 
57 57
 
58 58
     /**
@@ -62,110 +62,110 @@  discard block
 block discarded – undo
62 62
      */
63 63
     function info()
64 64
     {
65
-    	global $langs;
66
-      	return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
65
+        global $langs;
66
+            return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
67 67
     }
68 68
 
69 69
 
70
-	/**
71
-	 *  Renvoi un exemple de numerotation
72
-	 *
73
-	 *  @return     string      Example
74
-	 */
75
-	function getExample()
76
-	{
77
-		return $this->prefix."0501-0001";
78
-	}
79
-
80
-
81
-	/**
82
-	 *  Test si les numeros deje en vigueur dans la base ne provoquent pas de
83
-	 *  de conflits qui empechera cette numerotation de fonctionner.
84
-	 *
85
-	 *  @return     boolean     false si conflit, true si ok
86
-	 */
87
-	function canBeActivated()
88
-	{
89
-		global $conf,$langs,$db;
90
-
91
-		$payyymm=''; $max='';
92
-
93
-		$posindice=9;
94
-		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
95
-		$sql.= " FROM ".MAIN_DB_PREFIX."paiement";
96
-		$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
97
-		$sql.= " AND entity = ".$conf->entity;
98
-
99
-		$resql=$db->query($sql);
100
-		if ($resql)
101
-		{
102
-			$row = $db->fetch_row($resql);
103
-			if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; }
104
-		}
105
-		if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm))
106
-		{
107
-			$langs->load("errors");
108
-			$this->error=$langs->trans('ErrorNumRefModel', $max);
109
-			return false;
110
-		}
111
-
112
-		return true;
113
-	}
114
-
115
-	/**
116
-	 * 	Return next free value
117
-	 *
118
-	 *  @param	Societe		$objsoc     Object thirdparty
119
-	 *  @param  Object		$object		Object we need next value for
120
-	 *  @return string      			Value if KO, <0 if KO
121
-	 */
122
-	function getNextValue($objsoc,$object)
123
-	{
124
-		global $db,$conf;
125
-
126
-		// D'abord on recupere la valeur max
127
-		$posindice=9;
128
-		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
129
-		$sql.= " FROM ".MAIN_DB_PREFIX."paiement";
130
-		$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
131
-		$sql.= " AND entity = ".$conf->entity;
132
-
133
-		$resql=$db->query($sql);
134
-		if ($resql)
135
-		{
136
-			$obj = $db->fetch_object($resql);
137
-			if ($obj) $max = intval($obj->max);
138
-			else $max=0;
139
-		}
140
-		else
141
-		{
142
-			dol_syslog(__METHOD__, LOG_DEBUG);
143
-			return -1;
144
-		}
145
-
146
-		//$date=time();
147
-		$date=$object->datepaye;
148
-		$yymm = strftime("%y%m",$date);
149
-
150
-    	if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
151
-    	else $num = sprintf("%04s",$max+1);
152
-
153
-		dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
154
-		return $this->prefix.$yymm."-".$num;
155
-	}
70
+    /**
71
+     *  Renvoi un exemple de numerotation
72
+     *
73
+     *  @return     string      Example
74
+     */
75
+    function getExample()
76
+    {
77
+        return $this->prefix."0501-0001";
78
+    }
79
+
80
+
81
+    /**
82
+     *  Test si les numeros deje en vigueur dans la base ne provoquent pas de
83
+     *  de conflits qui empechera cette numerotation de fonctionner.
84
+     *
85
+     *  @return     boolean     false si conflit, true si ok
86
+     */
87
+    function canBeActivated()
88
+    {
89
+        global $conf,$langs,$db;
90
+
91
+        $payyymm=''; $max='';
92
+
93
+        $posindice=9;
94
+        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
95
+        $sql.= " FROM ".MAIN_DB_PREFIX."paiement";
96
+        $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
97
+        $sql.= " AND entity = ".$conf->entity;
98
+
99
+        $resql=$db->query($sql);
100
+        if ($resql)
101
+        {
102
+            $row = $db->fetch_row($resql);
103
+            if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; }
104
+        }
105
+        if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm))
106
+        {
107
+            $langs->load("errors");
108
+            $this->error=$langs->trans('ErrorNumRefModel', $max);
109
+            return false;
110
+        }
111
+
112
+        return true;
113
+    }
114
+
115
+    /**
116
+     * 	Return next free value
117
+     *
118
+     *  @param	Societe		$objsoc     Object thirdparty
119
+     *  @param  Object		$object		Object we need next value for
120
+     *  @return string      			Value if KO, <0 if KO
121
+     */
122
+    function getNextValue($objsoc,$object)
123
+    {
124
+        global $db,$conf;
125
+
126
+        // D'abord on recupere la valeur max
127
+        $posindice=9;
128
+        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
129
+        $sql.= " FROM ".MAIN_DB_PREFIX."paiement";
130
+        $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
131
+        $sql.= " AND entity = ".$conf->entity;
132
+
133
+        $resql=$db->query($sql);
134
+        if ($resql)
135
+        {
136
+            $obj = $db->fetch_object($resql);
137
+            if ($obj) $max = intval($obj->max);
138
+            else $max=0;
139
+        }
140
+        else
141
+        {
142
+            dol_syslog(__METHOD__, LOG_DEBUG);
143
+            return -1;
144
+        }
145
+
146
+        //$date=time();
147
+        $date=$object->datepaye;
148
+        $yymm = strftime("%y%m",$date);
149
+
150
+        if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
151
+        else $num = sprintf("%04s",$max+1);
152
+
153
+        dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
154
+        return $this->prefix.$yymm."-".$num;
155
+    }
156 156
 
157 157
 
158 158
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
159
-	/**
160
-	 *  Return next free value
161
-	 *
162
-	 *  @param	Societe		$objsoc     Object third party
163
-	 *  @param	string		$objforref	Object for number to search
164
-	 *  @return string      			Next free value
165
-	 */
166
-	function payment_get_num($objsoc,$objforref)
167
-	{
159
+    /**
160
+     *  Return next free value
161
+     *
162
+     *  @param	Societe		$objsoc     Object third party
163
+     *  @param	string		$objforref	Object for number to search
164
+     *  @return string      			Next free value
165
+     */
166
+    function payment_get_num($objsoc,$objforref)
167
+    {
168 168
         // phpcs:enable
169
-		return $this->getNextValue($objsoc,$objforref);
170
-	}
169
+        return $this->getNextValue($objsoc,$objforref);
170
+    }
171 171
 }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * \brief      File containing class for numbering module Cicada
23 23
  */
24 24
 
25
-require_once DOL_DOCUMENT_ROOT .'/core/modules/payment/modules_payment.php';
25
+require_once DOL_DOCUMENT_ROOT.'/core/modules/payment/modules_payment.php';
26 26
 
27 27
 /**
28 28
  *	Class to manage customer payment numbering rules Cicada
@@ -33,26 +33,26 @@  discard block
 block discarded – undo
33 33
      * Dolibarr version of the loaded document
34 34
      * @public string
35 35
      */
36
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
36
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
37 37
 
38
-	public $prefix='PAY';
38
+	public $prefix = 'PAY';
39 39
 
40 40
 	/**
41 41
 	 * @var string Error code (or message)
42 42
 	 */
43
-	public $error='';
43
+	public $error = '';
44 44
 
45 45
 	/**
46 46
 	 * @var string Nom du modele
47 47
 	 * @deprecated
48 48
 	 * @see name
49 49
 	 */
50
-	public $nom='Cicada';
50
+	public $nom = 'Cicada';
51 51
 
52 52
 	/**
53 53
 	 * @var string model name
54 54
 	 */
55
-	public $name='Cicada';
55
+	public $name = 'Cicada';
56 56
 
57 57
 
58 58
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     function info()
64 64
     {
65 65
     	global $langs;
66
-      	return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
66
+      	return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
67 67
     }
68 68
 
69 69
 
@@ -86,26 +86,26 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	function canBeActivated()
88 88
 	{
89
-		global $conf,$langs,$db;
89
+		global $conf, $langs, $db;
90 90
 
91
-		$payyymm=''; $max='';
91
+		$payyymm = ''; $max = '';
92 92
 
93
-		$posindice=9;
93
+		$posindice = 9;
94 94
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
95
-		$sql.= " FROM ".MAIN_DB_PREFIX."paiement";
96
-		$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
97
-		$sql.= " AND entity = ".$conf->entity;
95
+		$sql .= " FROM ".MAIN_DB_PREFIX."paiement";
96
+		$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
97
+		$sql .= " AND entity = ".$conf->entity;
98 98
 
99
-		$resql=$db->query($sql);
99
+		$resql = $db->query($sql);
100 100
 		if ($resql)
101 101
 		{
102 102
 			$row = $db->fetch_row($resql);
103
-			if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; }
103
+			if ($row) { $payyymm = substr($row[0], 0, 6); $max = $row[0]; }
104 104
 		}
105
-		if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm))
105
+		if ($payyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $payyymm))
106 106
 		{
107 107
 			$langs->load("errors");
108
-			$this->error=$langs->trans('ErrorNumRefModel', $max);
108
+			$this->error = $langs->trans('ErrorNumRefModel', $max);
109 109
 			return false;
110 110
 		}
111 111
 
@@ -119,23 +119,23 @@  discard block
 block discarded – undo
119 119
 	 *  @param  Object		$object		Object we need next value for
120 120
 	 *  @return string      			Value if KO, <0 if KO
121 121
 	 */
122
-	function getNextValue($objsoc,$object)
122
+	function getNextValue($objsoc, $object)
123 123
 	{
124
-		global $db,$conf;
124
+		global $db, $conf;
125 125
 
126 126
 		// D'abord on recupere la valeur max
127
-		$posindice=9;
127
+		$posindice = 9;
128 128
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
129
-		$sql.= " FROM ".MAIN_DB_PREFIX."paiement";
130
-		$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
131
-		$sql.= " AND entity = ".$conf->entity;
129
+		$sql .= " FROM ".MAIN_DB_PREFIX."paiement";
130
+		$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
131
+		$sql .= " AND entity = ".$conf->entity;
132 132
 
133
-		$resql=$db->query($sql);
133
+		$resql = $db->query($sql);
134 134
 		if ($resql)
135 135
 		{
136 136
 			$obj = $db->fetch_object($resql);
137 137
 			if ($obj) $max = intval($obj->max);
138
-			else $max=0;
138
+			else $max = 0;
139 139
 		}
140 140
 		else
141 141
 		{
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 		}
145 145
 
146 146
 		//$date=time();
147
-		$date=$object->datepaye;
148
-		$yymm = strftime("%y%m",$date);
147
+		$date = $object->datepaye;
148
+		$yymm = strftime("%y%m", $date);
149 149
 
150
-    	if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
151
-    	else $num = sprintf("%04s",$max+1);
150
+    	if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
151
+    	else $num = sprintf("%04s", $max + 1);
152 152
 
153 153
 		dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
154 154
 		return $this->prefix.$yymm."-".$num;
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 	 *  @param	string		$objforref	Object for number to search
164 164
 	 *  @return string      			Next free value
165 165
 	 */
166
-	function payment_get_num($objsoc,$objforref)
166
+	function payment_get_num($objsoc, $objforref)
167 167
 	{
168 168
         // phpcs:enable
169
-		return $this->getNextValue($objsoc,$objforref);
169
+		return $this->getNextValue($objsoc, $objforref);
170 170
 	}
171 171
 }
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -134,10 +134,12 @@  discard block
 block discarded – undo
134 134
 		if ($resql)
135 135
 		{
136 136
 			$obj = $db->fetch_object($resql);
137
-			if ($obj) $max = intval($obj->max);
138
-			else $max=0;
139
-		}
140
-		else
137
+			if ($obj) {
138
+			    $max = intval($obj->max);
139
+			} else {
140
+			    $max=0;
141
+			}
142
+		} else
141 143
 		{
142 144
 			dol_syslog(__METHOD__, LOG_DEBUG);
143 145
 			return -1;
@@ -147,8 +149,13 @@  discard block
 block discarded – undo
147 149
 		$date=$object->datepaye;
148 150
 		$yymm = strftime("%y%m",$date);
149 151
 
150
-    	if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
151
-    	else $num = sprintf("%04s",$max+1);
152
+    	if ($max >= (pow(10, 4) - 1)) {
153
+    	    $num=$max+1;
154
+    	}
155
+    	// If counter > 9999, we do not format on 4 chars, we take number as it is
156
+    	else {
157
+    	    $num = sprintf("%04s",$max+1);
158
+    	}
152 159
 
153 160
 		dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
154 161
 		return $this->prefix.$yymm."-".$num;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/payment/modules_payment.php 3 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -23,82 +23,82 @@
 block discarded – undo
23 23
 
24 24
 abstract class ModeleNumRefPayments
25 25
 {
26
-	/**
27
-	 * @var string Error code (or message)
28
-	 */
29
-	public $error='';
26
+    /**
27
+     * @var string Error code (or message)
28
+     */
29
+    public $error='';
30 30
 
31
-	/**
32
-	 *	Return if a module can be used or not
33
-	 *
34
-	 *	@return		boolean     true if module can be used
35
-	 */
36
-	function isEnabled()
37
-	{
38
-		return true;
39
-	}
31
+    /**
32
+     *	Return if a module can be used or not
33
+     *
34
+     *	@return		boolean     true if module can be used
35
+     */
36
+    function isEnabled()
37
+    {
38
+        return true;
39
+    }
40 40
 
41
-	/**
42
-	 *	Return the default description of numbering module
43
-	 *
44
-	 *	@return     string      Texte descripif
45
-	 */
46
-	function info()
47
-	{
48
-		global $langs;
49
-		$langs->load("bills");
50
-		return $langs->trans("NoDescription");
51
-	}
41
+    /**
42
+     *	Return the default description of numbering module
43
+     *
44
+     *	@return     string      Texte descripif
45
+     */
46
+    function info()
47
+    {
48
+        global $langs;
49
+        $langs->load("bills");
50
+        return $langs->trans("NoDescription");
51
+    }
52 52
 
53
-	/**
54
-	 *	Return numbering example
55
-	 *
56
-	 *	@return     string      Example
57
-	 */
58
-	function getExample()
59
-	{
60
-		global $langs;
61
-		$langs->load("bills");
62
-		return $langs->trans("NoExample");
63
-	}
53
+    /**
54
+     *	Return numbering example
55
+     *
56
+     *	@return     string      Example
57
+     */
58
+    function getExample()
59
+    {
60
+        global $langs;
61
+        $langs->load("bills");
62
+        return $langs->trans("NoExample");
63
+    }
64 64
 
65
-	/**
66
-	 *  Test if the existing numbers in the database do not cause conflicts that would prevent this numbering run.
67
-	 *
68
-	 *	@return     boolean     false si conflit, true si ok
69
-	 */
70
-	function canBeActivated()
71
-	{
72
-		return true;
73
-	}
65
+    /**
66
+     *  Test if the existing numbers in the database do not cause conflicts that would prevent this numbering run.
67
+     *
68
+     *	@return     boolean     false si conflit, true si ok
69
+     */
70
+    function canBeActivated()
71
+    {
72
+        return true;
73
+    }
74 74
 
75
-	/**
76
-	 *	Returns the next value
77
-	 *
78
-	 *	@param	Societe		$objsoc     Object thirdparty
79
-	 *	@param	Object		$object		Object we need next value for
80
-	 *	@return	string      Valeur
81
-	 */
82
-	function getNextValue($objsoc,$object)
83
-	{
84
-		global $langs;
85
-		return $langs->trans("NotAvailable");
86
-	}
75
+    /**
76
+     *	Returns the next value
77
+     *
78
+     *	@param	Societe		$objsoc     Object thirdparty
79
+     *	@param	Object		$object		Object we need next value for
80
+     *	@return	string      Valeur
81
+     */
82
+    function getNextValue($objsoc,$object)
83
+    {
84
+        global $langs;
85
+        return $langs->trans("NotAvailable");
86
+    }
87 87
 
88
-	/**
89
-	 *	Returns the module numbering version
90
-	 *
91
-	 *	@return     string      Value
92
-	 */
93
-	function getVersion()
94
-	{
95
-		global $langs;
96
-		$langs->load("admin");
88
+    /**
89
+     *	Returns the module numbering version
90
+     *
91
+     *	@return     string      Value
92
+     */
93
+    function getVersion()
94
+    {
95
+        global $langs;
96
+        $langs->load("admin");
97 97
 
98
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
99
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
100
-		if ($this->version == 'dolibarr') return DOL_VERSION;
101
-		if ($this->version) return $this->version;
102
-		return $langs->trans("NotAvailable");
103
-	}
98
+        if ($this->version == 'development') return $langs->trans("VersionDevelopment");
99
+        if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
100
+        if ($this->version == 'dolibarr') return DOL_VERSION;
101
+        if ($this->version) return $this->version;
102
+        return $langs->trans("NotAvailable");
103
+    }
104 104
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	/**
27 27
 	 * @var string Error code (or message)
28 28
 	 */
29
-	public $error='';
29
+	public $error = '';
30 30
 
31 31
 	/**
32 32
 	 *	Return if a module can be used or not
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 *	@param	Object		$object		Object we need next value for
80 80
 	 *	@return	string      Valeur
81 81
 	 */
82
-	function getNextValue($objsoc,$object)
82
+	function getNextValue($objsoc, $object)
83 83
 	{
84 84
 		global $langs;
85 85
 		return $langs->trans("NotAvailable");
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -142,10 +142,18 @@
 block discarded – undo
142 142
 		global $langs;
143 143
 		$langs->load("admin");
144 144
 
145
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
146
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
147
-		if ($this->version == 'dolibarr') return DOL_VERSION;
148
-		if ($this->version) return $this->version;
145
+		if ($this->version == 'development') {
146
+		    return $langs->trans("VersionDevelopment");
147
+		}
148
+		if ($this->version == 'experimental') {
149
+		    return $langs->trans("VersionExperimental");
150
+		}
151
+		if ($this->version == 'dolibarr') {
152
+		    return DOL_VERSION;
153
+		}
154
+		if ($this->version) {
155
+		    return $this->version;
156
+		}
149 157
 		return $langs->trans("NotAvailable");
150 158
 	}
151 159
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modDon.class.php 2 patches
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -35,131 +35,131 @@
 block discarded – undo
35 35
 class modDon extends DolibarrModules
36 36
 {
37 37
 
38
-	/**
39
-	 *   Constructor. Define names, constants, directories, boxes, permissions
40
-	 *
41
-	 *   @param      DoliDB		$db      Database handler
42
-	 */
43
-	function __construct($db)
44
-	{
45
-		$this->db = $db;
46
-		$this->numero = 700;
47
-
48
-		$this->family = "financial";
49
-		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
50
-		$this->name = preg_replace('/^mod/i','',get_class($this));
51
-		$this->description = "Gestion des dons";
52
-		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
53
-		$this->version = 'dolibarr';
54
-		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
55
-		// Name of png file (without png) used for this module.
56
-		// Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
57
-		$this->picto='bill';
58
-
59
-		// Data directories to create when module is enabled
60
-		$this->dirs = array("/don/temp");
61
-
62
-		// Dependancies
63
-		$this->depends = array();
64
-		$this->requiredby = array();
65
-
66
-		// Config pages
67
-		$this->config_page_url = array("donation.php@don");
68
-
69
-		// Constants
70
-		$this->const = array();
71
-		$r=0;
72
-
73
-		$this->const[$r][0] = "DON_ADDON_MODEL";
74
-		$this->const[$r][1] = "chaine";
75
-		$this->const[$r][2] = "html_cerfafr";
76
-		$this->const[$r][3] = 'Nom du gestionnaire de generation de recu de dons';
77
-		$this->const[$r][4] = 0;
78
-
79
-		$r++;
80
-		$this->const[$r][0] = "DONATION_ART200";
81
-		$this->const[$r][1] = "yesno";
82
-		$this->const[$r][2] = "0";
83
-		$this->const[$r][3] = 'Option Française - Eligibilité Art200 du CGI';
84
-		$this->const[$r][4] = 0;
85
-
86
-		$r++;
87
-		$this->const[$r][0] = "DONATION_ART238";
88
-		$this->const[$r][1] = "yesno";
89
-		$this->const[$r][2] = "0";
90
-		$this->const[$r][3] = 'Option Française - Eligibilité Art238 bis du CGI';
91
-		$this->const[$r][4] = 0;
92
-
93
-		$r++;
94
-		$this->const[$r][0] = "DONATION_ART885";
95
-		$this->const[$r][1] = "yesno";
96
-		$this->const[$r][2] = "0";
97
-		$this->const[$r][3] = 'Option Française - Eligibilité Art885-0 V bis du CGI';
98
-		$this->const[$r][4] = 0;
99
-
100
-		$r++;
101
-		$this->const[$r][0] = "DONATION_MESSAGE";
102
-		$this->const[$r][1] = "chaine";
103
-		$this->const[$r][2] = "Thank you";
104
-		$this->const[$r][3] = 'Message affiché sur le récépissé de versements ou dons';
105
-		$this->const[$r][4] = 0;
106
-
107
-		$r++;
108
-		$this->const[$r][0] = "DONATION_ACCOUNTINGACCOUNT";
109
-		$this->const[$r][1] = "chaine";
110
-		$this->const[$r][2] = "758";
111
-		$this->const[$r][3] = 'Compte comptable de remise des versements ou dons';
112
-		$this->const[$r][4] = 0;
113
-
114
-		// Boxes
115
-		$this->boxes = array();
116
-
117
-		// Permissions
118
-		$this->rights = array();
119
-		$this->rights_class = 'don';
120
-
121
-		$this->rights[1][0] = 701;
122
-		$this->rights[1][1] = 'Lire les dons';
123
-		$this->rights[1][2] = 'r';
124
-		$this->rights[1][3] = 1;
125
-		$this->rights[1][4] = 'lire';
126
-
127
-		$this->rights[2][0] = 702;
128
-		$this->rights[2][1] = 'Creer/modifier les dons';
129
-		$this->rights[2][2] = 'w';
130
-		$this->rights[2][3] = 0;
131
-		$this->rights[2][4] = 'creer';
132
-
133
-		$this->rights[3][0] = 703;
134
-		$this->rights[3][1] = 'Supprimer les dons';
135
-		$this->rights[3][2] = 'd';
136
-		$this->rights[3][3] = 0;
137
-		$this->rights[3][4] = 'supprimer';
138
-
139
-
140
-		// Menus
141
-		//-------
142
-		$this->menu = 1;        // This module add menu entries. They are coded into menu manager.
143
-	}
144
-
145
-
146
-	/**
147
-	 *		Function called when module is enabled.
148
-	 *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
149
-	 *		It also creates data directories
150
-	 *
38
+    /**
39
+     *   Constructor. Define names, constants, directories, boxes, permissions
40
+     *
41
+     *   @param      DoliDB		$db      Database handler
42
+     */
43
+    function __construct($db)
44
+    {
45
+        $this->db = $db;
46
+        $this->numero = 700;
47
+
48
+        $this->family = "financial";
49
+        // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
50
+        $this->name = preg_replace('/^mod/i','',get_class($this));
51
+        $this->description = "Gestion des dons";
52
+        // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
53
+        $this->version = 'dolibarr';
54
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
55
+        // Name of png file (without png) used for this module.
56
+        // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
57
+        $this->picto='bill';
58
+
59
+        // Data directories to create when module is enabled
60
+        $this->dirs = array("/don/temp");
61
+
62
+        // Dependancies
63
+        $this->depends = array();
64
+        $this->requiredby = array();
65
+
66
+        // Config pages
67
+        $this->config_page_url = array("donation.php@don");
68
+
69
+        // Constants
70
+        $this->const = array();
71
+        $r=0;
72
+
73
+        $this->const[$r][0] = "DON_ADDON_MODEL";
74
+        $this->const[$r][1] = "chaine";
75
+        $this->const[$r][2] = "html_cerfafr";
76
+        $this->const[$r][3] = 'Nom du gestionnaire de generation de recu de dons';
77
+        $this->const[$r][4] = 0;
78
+
79
+        $r++;
80
+        $this->const[$r][0] = "DONATION_ART200";
81
+        $this->const[$r][1] = "yesno";
82
+        $this->const[$r][2] = "0";
83
+        $this->const[$r][3] = 'Option Française - Eligibilité Art200 du CGI';
84
+        $this->const[$r][4] = 0;
85
+
86
+        $r++;
87
+        $this->const[$r][0] = "DONATION_ART238";
88
+        $this->const[$r][1] = "yesno";
89
+        $this->const[$r][2] = "0";
90
+        $this->const[$r][3] = 'Option Française - Eligibilité Art238 bis du CGI';
91
+        $this->const[$r][4] = 0;
92
+
93
+        $r++;
94
+        $this->const[$r][0] = "DONATION_ART885";
95
+        $this->const[$r][1] = "yesno";
96
+        $this->const[$r][2] = "0";
97
+        $this->const[$r][3] = 'Option Française - Eligibilité Art885-0 V bis du CGI';
98
+        $this->const[$r][4] = 0;
99
+
100
+        $r++;
101
+        $this->const[$r][0] = "DONATION_MESSAGE";
102
+        $this->const[$r][1] = "chaine";
103
+        $this->const[$r][2] = "Thank you";
104
+        $this->const[$r][3] = 'Message affiché sur le récépissé de versements ou dons';
105
+        $this->const[$r][4] = 0;
106
+
107
+        $r++;
108
+        $this->const[$r][0] = "DONATION_ACCOUNTINGACCOUNT";
109
+        $this->const[$r][1] = "chaine";
110
+        $this->const[$r][2] = "758";
111
+        $this->const[$r][3] = 'Compte comptable de remise des versements ou dons';
112
+        $this->const[$r][4] = 0;
113
+
114
+        // Boxes
115
+        $this->boxes = array();
116
+
117
+        // Permissions
118
+        $this->rights = array();
119
+        $this->rights_class = 'don';
120
+
121
+        $this->rights[1][0] = 701;
122
+        $this->rights[1][1] = 'Lire les dons';
123
+        $this->rights[1][2] = 'r';
124
+        $this->rights[1][3] = 1;
125
+        $this->rights[1][4] = 'lire';
126
+
127
+        $this->rights[2][0] = 702;
128
+        $this->rights[2][1] = 'Creer/modifier les dons';
129
+        $this->rights[2][2] = 'w';
130
+        $this->rights[2][3] = 0;
131
+        $this->rights[2][4] = 'creer';
132
+
133
+        $this->rights[3][0] = 703;
134
+        $this->rights[3][1] = 'Supprimer les dons';
135
+        $this->rights[3][2] = 'd';
136
+        $this->rights[3][3] = 0;
137
+        $this->rights[3][4] = 'supprimer';
138
+
139
+
140
+        // Menus
141
+        //-------
142
+        $this->menu = 1;        // This module add menu entries. They are coded into menu manager.
143
+    }
144
+
145
+
146
+    /**
147
+     *		Function called when module is enabled.
148
+     *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
149
+     *		It also creates data directories
150
+     *
151 151
      *      @param      string	$options    Options when enabling module ('', 'noboxes')
152
-	 *      @return     int             	1 if OK, 0 if KO
153
-	 */
154
-	function init($options='')
155
-	{
156
-		global $conf;
157
-
158
-		$sql = array(
159
-			 "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'donation' AND entity = ".$conf->entity,
160
-			 "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','donation',".$conf->entity.")",
161
-		);
162
-
163
-		return $this->_init($sql,$options);
164
-	}
152
+     *      @return     int             	1 if OK, 0 if KO
153
+     */
154
+    function init($options='')
155
+    {
156
+        global $conf;
157
+
158
+        $sql = array(
159
+                "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'donation' AND entity = ".$conf->entity,
160
+                "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','donation',".$conf->entity.")",
161
+        );
162
+
163
+        return $this->_init($sql,$options);
164
+    }
165 165
 }
166 166
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  *	\brief      Description and activation file for module Donation
27 27
  */
28 28
 
29
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
29
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
30 30
 
31 31
 
32 32
 /**
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$this->family = "financial";
49 49
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
50
-		$this->name = preg_replace('/^mod/i','',get_class($this));
50
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
51 51
 		$this->description = "Gestion des dons";
52 52
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
53 53
 		$this->version = 'dolibarr';
54 54
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
55 55
 		// Name of png file (without png) used for this module.
56 56
 		// Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
57
-		$this->picto='bill';
57
+		$this->picto = 'bill';
58 58
 
59 59
 		// Data directories to create when module is enabled
60 60
 		$this->dirs = array("/don/temp");
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 		// Constants
70 70
 		$this->const = array();
71
-		$r=0;
71
+		$r = 0;
72 72
 
73 73
 		$this->const[$r][0] = "DON_ADDON_MODEL";
74 74
 		$this->const[$r][1] = "chaine";
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
 		// Menus
141 141
 		//-------
142
-		$this->menu = 1;        // This module add menu entries. They are coded into menu manager.
142
+		$this->menu = 1; // This module add menu entries. They are coded into menu manager.
143 143
 	}
144 144
 
145 145
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      *      @param      string	$options    Options when enabling module ('', 'noboxes')
152 152
 	 *      @return     int             	1 if OK, 0 if KO
153 153
 	 */
154
-	function init($options='')
154
+	function init($options = '')
155 155
 	{
156 156
 		global $conf;
157 157
 
@@ -160,6 +160,6 @@  discard block
 block discarded – undo
160 160
 			 "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','donation',".$conf->entity.")",
161 161
 		);
162 162
 
163
-		return $this->_init($sql,$options);
163
+		return $this->_init($sql, $options);
164 164
 	}
165 165
 }
166 166
\ No newline at end of file
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modAsset.class.php 2 patches
Indentation   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -32,122 +32,122 @@  discard block
 block discarded – undo
32 32
  */
33 33
 class modAsset extends DolibarrModules
34 34
 {
35
-	/**
36
-	 * Constructor. Define names, constants, directories, boxes, permissions
37
-	 *
38
-	 * @param DoliDB $db Database handler
39
-	 */
40
-	public function __construct($db)
41
-	{
42
-		global $langs,$conf;
43
-
44
-		$this->db = $db;
45
-
46
-		// Id for module (must be unique).
47
-		// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
48
-		$this->numero = 51000;		// TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module
49
-		// Key text used to identify module (for permissions, menus, etc...)
50
-		$this->rights_class = 'asset';
51
-
52
-		// Family can be 'crm','financial','hr','projects','products','ecm','technic','interface','other'
53
-		// It is used to group modules by family in module setup page
54
-		$this->family = "financial";
55
-		// Module position in the family on 2 digits ('01', '10', '20', ...)
56
-		$this->module_position = '70';
57
-		// Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
58
-		//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
59
-
60
-		// Module label (no space allowed), used if translation string 'ModuleAssetsName' not found (MyModue is name of module).
61
-		$this->name = preg_replace('/^mod/i','',get_class($this));
62
-		// Module description, used if translation string 'ModuleAssetsDesc' not found (MyModue is name of module).
63
-		$this->description = "Assets module";
64
-		// Used only if file README.md and README-LL.md not found.
65
-		$this->descriptionlong = "Assets module to manage assets module and depreciation charge on Dolibarr";
66
-
67
-		// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
68
-		$this->version = 'development';
69
-		// Key used in llx_const table to save module status enabled/disabled (where ASSETS is value of property name of module in uppercase)
70
-		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
71
-		// Name of image file used for this module.
72
-		// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
73
-		// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
74
-		$this->picto='generic';
75
-
76
-		// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
77
-		// for default path (eg: /asset/core/xxxxx) (0=disable, 1=enable)
78
-		// for specific path of parts (eg: /asset/core/modules/barcode)
79
-		// for specific css file (eg: /asset/css/assets.css.php)
80
-		$this->module_parts = array();
81
-
82
-		// Data directories to create when module is enabled.
83
-		// Example: this->dirs = array("/asset/temp","/asset/subdir");
84
-		$this->dirs = array();
85
-
86
-		// Config pages. Put here list of php page, stored into assets/admin directory, to use to setup module.
87
-		$this->config_page_url = array("setup.php@asset");
88
-
89
-		// Dependencies
90
-		$this->hidden = false;			// A condition to hide module
91
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
92
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
93
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
94
-		$this->langfiles = array("assets");
95
-		$this->phpmin = array(5,4);					// Minimum version of PHP required by module
96
-		$this->need_dolibarr_version = array(7,0);	// Minimum version of Dolibarr required by module
97
-		$this->warnings_activation = array();                     // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
98
-		$this->warnings_activation_ext = array();                 // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
99
-		//$this->automatic_activation = array('FR'=>'AssetsWasAutomaticallyActivatedBecauseOfYourCountryChoice');
100
-		//$this->always_enabled = true;								// If true, can't be disabled
101
-
102
-		// Constants
103
-		// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
104
-		// Example: $this->const=array(0=>array('ASSETS_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
105
-		//                             1=>array('ASSETS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
106
-		// );
107
-		$this->const = array(
108
-			1=>array('ASSET_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
109
-		);
110
-
111
-
112
-		if (! isset($conf->asset) || ! isset($conf->asset->enabled))
113
-		{
114
-			$conf->asset=new stdClass();
115
-			$conf->asset->enabled=0;
116
-		}
117
-
118
-
119
-		// Array to add new pages in new tabs
120
-		$this->tabs = array();
121
-		// Example:
122
-		// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@assets:$user->rights->assets->read:/assets/mynewtab1.php?id=__ID__');  					// To add a new tab identified by code tabname1
123
-		// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@assets:$user->rights->othermodule->read:/assets/mynewtab2.php?id=__ID__',  	// To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
124
-		// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove');                                                     										// To remove an existing tab identified by code tabname
125
-		//
126
-		// Where objecttype can be
127
-		// 'categories_x'	  to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
128
-		// 'contact'          to add a tab in contact view
129
-		// 'contract'         to add a tab in contract view
130
-		// 'group'            to add a tab in group view
131
-		// 'intervention'     to add a tab in intervention view
132
-		// 'invoice'          to add a tab in customer invoice view
133
-		// 'invoice_supplier' to add a tab in supplier invoice view
134
-		// 'member'           to add a tab in fundation member view
135
-		// 'opensurveypoll'	  to add a tab in opensurvey poll view
136
-		// 'order'            to add a tab in customer order view
137
-		// 'order_supplier'   to add a tab in supplier order view
138
-		// 'payment'		  to add a tab in payment view
139
-		// 'payment_supplier' to add a tab in supplier payment view
140
-		// 'product'          to add a tab in product view
141
-		// 'propal'           to add a tab in propal view
142
-		// 'project'          to add a tab in project view
143
-		// 'stock'            to add a tab in stock view
144
-		// 'thirdparty'       to add a tab in third party view
145
-		// 'user'             to add a tab in user view
146
-
147
-
148
-		// Dictionaries
149
-		$this->dictionaries=array();
150
-		/* Example:
35
+    /**
36
+     * Constructor. Define names, constants, directories, boxes, permissions
37
+     *
38
+     * @param DoliDB $db Database handler
39
+     */
40
+    public function __construct($db)
41
+    {
42
+        global $langs,$conf;
43
+
44
+        $this->db = $db;
45
+
46
+        // Id for module (must be unique).
47
+        // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
48
+        $this->numero = 51000;		// TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module
49
+        // Key text used to identify module (for permissions, menus, etc...)
50
+        $this->rights_class = 'asset';
51
+
52
+        // Family can be 'crm','financial','hr','projects','products','ecm','technic','interface','other'
53
+        // It is used to group modules by family in module setup page
54
+        $this->family = "financial";
55
+        // Module position in the family on 2 digits ('01', '10', '20', ...)
56
+        $this->module_position = '70';
57
+        // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
58
+        //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
59
+
60
+        // Module label (no space allowed), used if translation string 'ModuleAssetsName' not found (MyModue is name of module).
61
+        $this->name = preg_replace('/^mod/i','',get_class($this));
62
+        // Module description, used if translation string 'ModuleAssetsDesc' not found (MyModue is name of module).
63
+        $this->description = "Assets module";
64
+        // Used only if file README.md and README-LL.md not found.
65
+        $this->descriptionlong = "Assets module to manage assets module and depreciation charge on Dolibarr";
66
+
67
+        // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
68
+        $this->version = 'development';
69
+        // Key used in llx_const table to save module status enabled/disabled (where ASSETS is value of property name of module in uppercase)
70
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
71
+        // Name of image file used for this module.
72
+        // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
73
+        // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
74
+        $this->picto='generic';
75
+
76
+        // Defined all module parts (triggers, login, substitutions, menus, css, etc...)
77
+        // for default path (eg: /asset/core/xxxxx) (0=disable, 1=enable)
78
+        // for specific path of parts (eg: /asset/core/modules/barcode)
79
+        // for specific css file (eg: /asset/css/assets.css.php)
80
+        $this->module_parts = array();
81
+
82
+        // Data directories to create when module is enabled.
83
+        // Example: this->dirs = array("/asset/temp","/asset/subdir");
84
+        $this->dirs = array();
85
+
86
+        // Config pages. Put here list of php page, stored into assets/admin directory, to use to setup module.
87
+        $this->config_page_url = array("setup.php@asset");
88
+
89
+        // Dependencies
90
+        $this->hidden = false;			// A condition to hide module
91
+        $this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
92
+        $this->requiredby = array();	// List of module ids to disable if this one is disabled
93
+        $this->conflictwith = array();	// List of module class names as string this module is in conflict with
94
+        $this->langfiles = array("assets");
95
+        $this->phpmin = array(5,4);					// Minimum version of PHP required by module
96
+        $this->need_dolibarr_version = array(7,0);	// Minimum version of Dolibarr required by module
97
+        $this->warnings_activation = array();                     // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
98
+        $this->warnings_activation_ext = array();                 // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
99
+        //$this->automatic_activation = array('FR'=>'AssetsWasAutomaticallyActivatedBecauseOfYourCountryChoice');
100
+        //$this->always_enabled = true;								// If true, can't be disabled
101
+
102
+        // Constants
103
+        // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
104
+        // Example: $this->const=array(0=>array('ASSETS_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
105
+        //                             1=>array('ASSETS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
106
+        // );
107
+        $this->const = array(
108
+            1=>array('ASSET_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
109
+        );
110
+
111
+
112
+        if (! isset($conf->asset) || ! isset($conf->asset->enabled))
113
+        {
114
+            $conf->asset=new stdClass();
115
+            $conf->asset->enabled=0;
116
+        }
117
+
118
+
119
+        // Array to add new pages in new tabs
120
+        $this->tabs = array();
121
+        // Example:
122
+        // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@assets:$user->rights->assets->read:/assets/mynewtab1.php?id=__ID__');  					// To add a new tab identified by code tabname1
123
+        // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@assets:$user->rights->othermodule->read:/assets/mynewtab2.php?id=__ID__',  	// To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
124
+        // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove');                                                     										// To remove an existing tab identified by code tabname
125
+        //
126
+        // Where objecttype can be
127
+        // 'categories_x'	  to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
128
+        // 'contact'          to add a tab in contact view
129
+        // 'contract'         to add a tab in contract view
130
+        // 'group'            to add a tab in group view
131
+        // 'intervention'     to add a tab in intervention view
132
+        // 'invoice'          to add a tab in customer invoice view
133
+        // 'invoice_supplier' to add a tab in supplier invoice view
134
+        // 'member'           to add a tab in fundation member view
135
+        // 'opensurveypoll'	  to add a tab in opensurvey poll view
136
+        // 'order'            to add a tab in customer order view
137
+        // 'order_supplier'   to add a tab in supplier order view
138
+        // 'payment'		  to add a tab in payment view
139
+        // 'payment_supplier' to add a tab in supplier payment view
140
+        // 'product'          to add a tab in product view
141
+        // 'propal'           to add a tab in propal view
142
+        // 'project'          to add a tab in project view
143
+        // 'stock'            to add a tab in stock view
144
+        // 'thirdparty'       to add a tab in third party view
145
+        // 'user'             to add a tab in user view
146
+
147
+
148
+        // Dictionaries
149
+        $this->dictionaries=array();
150
+        /* Example:
151 151
 		$this->dictionaries=array(
152 152
 			'langs'=>'mylangfile@assets',
153 153
 			'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"),		// List of tables we want to see into dictonnary editor
@@ -163,69 +163,69 @@  discard block
 block discarded – undo
163 163
 		*/
164 164
 
165 165
 
166
-		// Boxes/Widgets
167
-		// Add here list of php file(s) stored in assets/core/boxes that contains class to show a widget.
168
-		$this->boxes = array(
169
-			//0=>array('file'=>'assetswidget1.php@asset','note'=>'Widget provided by Assets','enabledbydefaulton'=>'Home'),
170
-			//1=>array('file'=>'assetswidget2.php@asset','note'=>'Widget provided by Assets'),
171
-			//2=>array('file'=>'assetswidget3.php@asset','note'=>'Widget provided by Assets')
172
-		);
173
-
174
-
175
-		// Cronjobs (List of cron jobs entries to add when module is enabled)
176
-		// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
177
-		//$this->cronjobs = array(
178
-		//	0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/asset/class/asset.class.php', 'objectname'=>'Asset', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true)
179
-		//);
180
-		// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true),
181
-		//                                1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true)
182
-		// );
183
-
184
-
185
-		// Permissions
186
-		$this->rights = array();		// Permission array used by this module
187
-
188
-		$r=0;
189
-		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
190
-		$this->rights[$r][1] = 'Read assets';		// Permission label
191
-		$this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
192
-		$this->rights[$r][4] = 'read';				// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
193
-		$this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
194
-
195
-		$r++;
196
-		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
197
-		$this->rights[$r][1] = 'Create/Update assets';	// Permission label
198
-		$this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
199
-		$this->rights[$r][4] = 'write';				// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
200
-		$this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
201
-
202
-		$r++;
203
-		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
204
-		$this->rights[$r][1] = 'Delete assets';		// Permission label
205
-		$this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
206
-		$this->rights[$r][4] = 'delete';			// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
207
-		$this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
208
-
209
-
210
-		// Main menu entries
211
-		$this->menu = array();			// List of menus to add
212
-		$r=0;
213
-
214
-		// Add here entries to declare new menus
215
-		$this->menu = 1;        // This module add menu entries. They are coded into menu manager.
216
-
217
-		// Exports
218
-		//--------
219
-		$r=1;
220
-
221
-		// $this->export_code[$r]          Code unique identifiant l'export (tous modules confondus)
222
-		// $this->export_label[$r]         Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
223
-		// $this->export_permission[$r]    Liste des codes permissions requis pour faire l'export
224
-		// $this->export_fields_sql[$r]    Liste des champs exportables en codif sql
225
-		// $this->export_fields_name[$r]   Liste des champs exportables en codif traduction
226
-		// $this->export_sql[$r]           Requete sql qui offre les donnees a l'export
227
-
228
-		/*
166
+        // Boxes/Widgets
167
+        // Add here list of php file(s) stored in assets/core/boxes that contains class to show a widget.
168
+        $this->boxes = array(
169
+            //0=>array('file'=>'assetswidget1.php@asset','note'=>'Widget provided by Assets','enabledbydefaulton'=>'Home'),
170
+            //1=>array('file'=>'assetswidget2.php@asset','note'=>'Widget provided by Assets'),
171
+            //2=>array('file'=>'assetswidget3.php@asset','note'=>'Widget provided by Assets')
172
+        );
173
+
174
+
175
+        // Cronjobs (List of cron jobs entries to add when module is enabled)
176
+        // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
177
+        //$this->cronjobs = array(
178
+        //	0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/asset/class/asset.class.php', 'objectname'=>'Asset', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true)
179
+        //);
180
+        // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true),
181
+        //                                1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true)
182
+        // );
183
+
184
+
185
+        // Permissions
186
+        $this->rights = array();		// Permission array used by this module
187
+
188
+        $r=0;
189
+        $this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
190
+        $this->rights[$r][1] = 'Read assets';		// Permission label
191
+        $this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
192
+        $this->rights[$r][4] = 'read';				// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
193
+        $this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
194
+
195
+        $r++;
196
+        $this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
197
+        $this->rights[$r][1] = 'Create/Update assets';	// Permission label
198
+        $this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
199
+        $this->rights[$r][4] = 'write';				// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
200
+        $this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
201
+
202
+        $r++;
203
+        $this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
204
+        $this->rights[$r][1] = 'Delete assets';		// Permission label
205
+        $this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
206
+        $this->rights[$r][4] = 'delete';			// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
207
+        $this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
208
+
209
+
210
+        // Main menu entries
211
+        $this->menu = array();			// List of menus to add
212
+        $r=0;
213
+
214
+        // Add here entries to declare new menus
215
+        $this->menu = 1;        // This module add menu entries. They are coded into menu manager.
216
+
217
+        // Exports
218
+        //--------
219
+        $r=1;
220
+
221
+        // $this->export_code[$r]          Code unique identifiant l'export (tous modules confondus)
222
+        // $this->export_label[$r]         Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
223
+        // $this->export_permission[$r]    Liste des codes permissions requis pour faire l'export
224
+        // $this->export_fields_sql[$r]    Liste des champs exportables en codif sql
225
+        // $this->export_fields_name[$r]   Liste des champs exportables en codif traduction
226
+        // $this->export_sql[$r]           Requete sql qui offre les donnees a l'export
227
+
228
+        /*
229 229
 		$r++;
230 230
 		$this->export_code[$r]=$this->rights_class.'_'.$r;
231 231
 		$this->export_label[$r]='AssetsLines';
@@ -310,25 +310,25 @@  discard block
 block discarded – undo
310 310
 			'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d')
311 311
 		);
312 312
 		*/
313
-	}
314
-
315
-	/**
316
-	 *	Function called when module is enabled.
317
-	 *	The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
318
-	 *	It also creates data directories
319
-	 *
320
-	 *	@param      string	$options    Options when enabling module ('', 'noboxes')
321
-	 *	@return     int             	1 if OK, 0 if KO
322
-	 */
323
-	function init($options='')
324
-	{
325
-		global $conf;
326
-
327
-		// Permissions
328
-		$this->remove($options);
329
-
330
-		$sql = array();
331
-
332
-		return $this->_init($sql,$options);
333
-	}
313
+    }
314
+
315
+    /**
316
+     *	Function called when module is enabled.
317
+     *	The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
318
+     *	It also creates data directories
319
+     *
320
+     *	@param      string	$options    Options when enabling module ('', 'noboxes')
321
+     *	@return     int             	1 if OK, 0 if KO
322
+     */
323
+    function init($options='')
324
+    {
325
+        global $conf;
326
+
327
+        // Permissions
328
+        $this->remove($options);
329
+
330
+        $sql = array();
331
+
332
+        return $this->_init($sql,$options);
333
+    }
334 334
 }
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *  \ingroup    asset
25 25
  *  \brief      Description and activation file for module Assets
26 26
  */
27
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
27
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28 28
 
29 29
 
30 30
 /**
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function __construct($db)
41 41
 	{
42
-		global $langs,$conf;
42
+		global $langs, $conf;
43 43
 
44 44
 		$this->db = $db;
45 45
 
46 46
 		// Id for module (must be unique).
47 47
 		// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
48
-		$this->numero = 51000;		// TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module
48
+		$this->numero = 51000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module
49 49
 		// Key text used to identify module (for permissions, menus, etc...)
50 50
 		$this->rights_class = 'asset';
51 51
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
59 59
 
60 60
 		// Module label (no space allowed), used if translation string 'ModuleAssetsName' not found (MyModue is name of module).
61
-		$this->name = preg_replace('/^mod/i','',get_class($this));
61
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
62 62
 		// Module description, used if translation string 'ModuleAssetsDesc' not found (MyModue is name of module).
63 63
 		$this->description = "Assets module";
64 64
 		// Used only if file README.md and README-LL.md not found.
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		// Name of image file used for this module.
72 72
 		// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
73 73
 		// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
74
-		$this->picto='generic';
74
+		$this->picto = 'generic';
75 75
 
76 76
 		// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
77 77
 		// for default path (eg: /asset/core/xxxxx) (0=disable, 1=enable)
@@ -87,15 +87,15 @@  discard block
 block discarded – undo
87 87
 		$this->config_page_url = array("setup.php@asset");
88 88
 
89 89
 		// Dependencies
90
-		$this->hidden = false;			// A condition to hide module
91
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
92
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
93
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
90
+		$this->hidden = false; // A condition to hide module
91
+		$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
92
+		$this->requiredby = array(); // List of module ids to disable if this one is disabled
93
+		$this->conflictwith = array(); // List of module class names as string this module is in conflict with
94 94
 		$this->langfiles = array("assets");
95
-		$this->phpmin = array(5,4);					// Minimum version of PHP required by module
96
-		$this->need_dolibarr_version = array(7,0);	// Minimum version of Dolibarr required by module
97
-		$this->warnings_activation = array();                     // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
98
-		$this->warnings_activation_ext = array();                 // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
95
+		$this->phpmin = array(5, 4); // Minimum version of PHP required by module
96
+		$this->need_dolibarr_version = array(7, 0); // Minimum version of Dolibarr required by module
97
+		$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
98
+		$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
99 99
 		//$this->automatic_activation = array('FR'=>'AssetsWasAutomaticallyActivatedBecauseOfYourCountryChoice');
100 100
 		//$this->always_enabled = true;								// If true, can't be disabled
101 101
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 		);
110 110
 
111 111
 
112
-		if (! isset($conf->asset) || ! isset($conf->asset->enabled))
112
+		if (!isset($conf->asset) || !isset($conf->asset->enabled))
113 113
 		{
114
-			$conf->asset=new stdClass();
115
-			$conf->asset->enabled=0;
114
+			$conf->asset = new stdClass();
115
+			$conf->asset->enabled = 0;
116 116
 		}
117 117
 
118 118
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 
148 148
 		// Dictionaries
149
-		$this->dictionaries=array();
149
+		$this->dictionaries = array();
150 150
 		/* Example:
151 151
 		$this->dictionaries=array(
152 152
 			'langs'=>'mylangfile@assets',
@@ -183,40 +183,40 @@  discard block
 block discarded – undo
183 183
 
184 184
 
185 185
 		// Permissions
186
-		$this->rights = array();		// Permission array used by this module
186
+		$this->rights = array(); // Permission array used by this module
187 187
 
188
-		$r=0;
189
-		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
190
-		$this->rights[$r][1] = 'Read assets';		// Permission label
191
-		$this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
192
-		$this->rights[$r][4] = 'read';				// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
193
-		$this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
188
+		$r = 0;
189
+		$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
190
+		$this->rights[$r][1] = 'Read assets'; // Permission label
191
+		$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
192
+		$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
193
+		$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
194 194
 
195 195
 		$r++;
196
-		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
197
-		$this->rights[$r][1] = 'Create/Update assets';	// Permission label
198
-		$this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
199
-		$this->rights[$r][4] = 'write';				// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
200
-		$this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
196
+		$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
197
+		$this->rights[$r][1] = 'Create/Update assets'; // Permission label
198
+		$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
199
+		$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
200
+		$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
201 201
 
202 202
 		$r++;
203
-		$this->rights[$r][0] = $this->numero + $r;	// Permission id (must not be already used)
204
-		$this->rights[$r][1] = 'Delete assets';		// Permission label
205
-		$this->rights[$r][3] = 1; 					// Permission by default for new user (0/1)
206
-		$this->rights[$r][4] = 'delete';			// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
207
-		$this->rights[$r][5] = '';					// In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
203
+		$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
204
+		$this->rights[$r][1] = 'Delete assets'; // Permission label
205
+		$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
206
+		$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
207
+		$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2)
208 208
 
209 209
 
210 210
 		// Main menu entries
211
-		$this->menu = array();			// List of menus to add
212
-		$r=0;
211
+		$this->menu = array(); // List of menus to add
212
+		$r = 0;
213 213
 
214 214
 		// Add here entries to declare new menus
215
-		$this->menu = 1;        // This module add menu entries. They are coded into menu manager.
215
+		$this->menu = 1; // This module add menu entries. They are coded into menu manager.
216 216
 
217 217
 		// Exports
218 218
 		//--------
219
-		$r=1;
219
+		$r = 1;
220 220
 
221 221
 		// $this->export_code[$r]          Code unique identifiant l'export (tous modules confondus)
222 222
 		// $this->export_label[$r]         Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code)
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 *	@param      string	$options    Options when enabling module ('', 'noboxes')
321 321
 	 *	@return     int             	1 if OK, 0 if KO
322 322
 	 */
323
-	function init($options='')
323
+	function init($options = '')
324 324
 	{
325 325
 		global $conf;
326 326
 
@@ -329,6 +329,6 @@  discard block
 block discarded – undo
329 329
 
330 330
 		$sql = array();
331 331
 
332
-		return $this->_init($sql,$options);
332
+		return $this->_init($sql, $options);
333 333
 	}
334 334
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modUser.class.php 3 patches
Indentation   +261 added lines, -261 removed lines patch added patch discarded remove patch
@@ -33,284 +33,284 @@
 block discarded – undo
33 33
 class modUser extends DolibarrModules
34 34
 {
35 35
 
36
-	/**
37
-	 *   Constructor. Define names, constants, directories, boxes, permissions
38
-	 *
39
-	 *   @param      DoliDB		$db      Database handler
40
-	 */
41
-	function __construct($db)
42
-	{
43
-		global $conf;
44
-
45
-		$this->db = $db;
46
-		$this->numero = 0;
47
-
48
-		$this->family = "hr";		// Family for module (or "base" if core module)
49
-		$this->module_position = '10';
50
-		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
51
-		$this->name = preg_replace('/^mod/i','',get_class($this));
52
-		$this->description = "Gestion des utilisateurs (requis)";
53
-
54
-		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
55
-		$this->version = 'dolibarr';
56
-
57
-		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
58
-		$this->picto='group';
59
-
60
-		// Data directories to create when module is enabled
61
-		$this->dirs = array("/users/temp");
62
-
63
-		// Config pages
64
-		$this->config_page_url = array("user.php");
65
-
66
-		// Dependencies
67
-		$this->hidden = false;			// A condition to hide module
68
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
69
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
70
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
71
-		$this->phpmin = array(5,4);		// Minimum version of PHP required by module
72
-		$this->langfiles = array("main","users","companies","members",'salaries');
73
-		$this->always_enabled = true;	// Can't be disabled
74
-
75
-		// Constants
76
-		$this->const = array();
77
-
78
-		// Boxes
79
-		$this->boxes = array(
80
-		    0=>array('file'=>'box_lastlogin.php','enabledbydefaulton'=>'Home'),
81
-		);
82
-
83
-		// Permissions
84
-		$this->rights = array();
85
-		$this->rights_class = 'user';
86
-		$this->rights_admin_allowed = 1;	// Admin is always granted of permission (even when module is disabled)
87
-		$r=0;
88
-
89
-		$r++;
90
-		$this->rights[$r][0] = 251;
91
-		$this->rights[$r][1] = 'Consulter les autres utilisateurs';
92
-		$this->rights[$r][2] = 'r';
93
-		$this->rights[$r][3] = 0;
94
-		$this->rights[$r][4] = 'user';
95
-		$this->rights[$r][5] = 'lire';
96
-
97
-		$r++;
98
-		$this->rights[$r][0] = 252;
99
-		$this->rights[$r][1] = 'Consulter les permissions des autres utilisateurs';
100
-		$this->rights[$r][2] = 'r';
101
-		$this->rights[$r][3] = 0;
102
-		$this->rights[$r][4] = 'user_advance';
103
-		$this->rights[$r][5] = 'readperms';
104
-
105
-		$r++;
106
-		$this->rights[$r][0] = 253;
107
-		$this->rights[$r][1] = 'Creer/modifier utilisateurs internes et externes';
108
-		$this->rights[$r][2] = 'w';
109
-		$this->rights[$r][3] = 0;
110
-		$this->rights[$r][4] = 'user';
111
-		$this->rights[$r][5] = 'creer';
112
-
113
-		$r++;
114
-		$this->rights[$r][0] = 254;
115
-		$this->rights[$r][1] = 'Creer/modifier utilisateurs externes seulement';
116
-		$this->rights[$r][2] = 'w';
117
-		$this->rights[$r][3] = 0;
118
-		$this->rights[$r][4] = 'user_advance';
119
-		$this->rights[$r][5] = 'write';
120
-
121
-		$r++;
122
-		$this->rights[$r][0] = 255;
123
-		$this->rights[$r][1] = 'Modifier le mot de passe des autres utilisateurs';
124
-		$this->rights[$r][2] = 'w';
125
-		$this->rights[$r][3] = 0;
126
-		$this->rights[$r][4] = 'user';
127
-		$this->rights[$r][5] = 'password';
128
-
129
-		$r++;
130
-		$this->rights[$r][0] = 256;
131
-		$this->rights[$r][1] = 'Supprimer ou desactiver les autres utilisateurs';
132
-		$this->rights[$r][2] = 'd';
133
-		$this->rights[$r][3] = 0;
134
-		$this->rights[$r][4] = 'user';
135
-		$this->rights[$r][5] = 'supprimer';
136
-
137
-		$r++;
138
-		$this->rights[$r][0] = 341;
139
-		$this->rights[$r][1] = 'Consulter ses propres permissions';
140
-		$this->rights[$r][2] = 'r';
141
-		$this->rights[$r][3] = 0;
142
-		$this->rights[$r][4] = 'self_advance';        // Visible if option MAIN_USE_ADVANCED_PERMS is on
143
-		$this->rights[$r][5] = 'readperms';
144
-
145
-		$r++;
146
-		$this->rights[$r][0] = 342;
147
-		$this->rights[$r][1] = 'Creer/modifier ses propres infos utilisateur';
148
-		$this->rights[$r][2] = 'w';
149
-		$this->rights[$r][3] = 0;
150
-		$this->rights[$r][4] = 'self';
151
-		$this->rights[$r][5] = 'creer';
152
-
153
-		$r++;
154
-		$this->rights[$r][0] = 343;
155
-		$this->rights[$r][1] = 'Modifier son propre mot de passe';
156
-		$this->rights[$r][2] = 'w';
157
-		$this->rights[$r][3] = 0;
158
-		$this->rights[$r][4] = 'self';
159
-		$this->rights[$r][5] = 'password';
160
-
161
-		$r++;
162
-		$this->rights[$r][0] = 344;
163
-		$this->rights[$r][1] = 'Modifier ses propres permissions';
164
-		$this->rights[$r][2] = 'w';
165
-		$this->rights[$r][3] = 0;
166
-		$this->rights[$r][4] = 'self_advance';          // Visible if option MAIN_USE_ADVANCED_PERMS is on
167
-		$this->rights[$r][5] = 'writeperms';
168
-
169
-		$r++;
170
-		$this->rights[$r][0] = 351;
171
-		$this->rights[$r][1] = 'Consulter les groupes';
172
-		$this->rights[$r][2] = 'r';
173
-		$this->rights[$r][3] = 0;
174
-		$this->rights[$r][4] = 'group_advance';        // Visible if option MAIN_USE_ADVANCED_PERMS is on
175
-		$this->rights[$r][5] = 'read';
176
-
177
-		$r++;
178
-		$this->rights[$r][0] = 352;
179
-		$this->rights[$r][1] = 'Consulter les permissions des groupes';
180
-		$this->rights[$r][2] = 'r';
181
-		$this->rights[$r][3] = 0;
182
-		$this->rights[$r][4] = 'group_advance';       // Visible if option MAIN_USE_ADVANCED_PERMS is on
183
-		$this->rights[$r][5] = 'readperms';
184
-
185
-		$r++;
186
-		$this->rights[$r][0] = 353;
187
-		$this->rights[$r][1] = 'Creer/modifier les groupes et leurs permissions';
188
-		$this->rights[$r][2] = 'w';
189
-		$this->rights[$r][3] = 0;
190
-		$this->rights[$r][4] = 'group_advance';      // Visible if option MAIN_USE_ADVANCED_PERMS is on
191
-		$this->rights[$r][5] = 'write';
192
-
193
-		$r++;
194
-		$this->rights[$r][0] = 354;
195
-		$this->rights[$r][1] = 'Supprimer ou desactiver les groupes';
196
-		$this->rights[$r][2] = 'd';
197
-		$this->rights[$r][3] = 0;
198
-		$this->rights[$r][4] = 'group_advance';      // Visible if option MAIN_USE_ADVANCED_PERMS is on
199
-		$this->rights[$r][5] = 'delete';
200
-
201
-		$r++;
202
-		$this->rights[$r][0] = 358;
203
-		$this->rights[$r][1] = 'Exporter les utilisateurs';
204
-		$this->rights[$r][2] = 'r';
205
-		$this->rights[$r][3] = 0;
206
-		$this->rights[$r][4] = 'user';
207
-		$this->rights[$r][5] = 'export';
36
+    /**
37
+     *   Constructor. Define names, constants, directories, boxes, permissions
38
+     *
39
+     *   @param      DoliDB		$db      Database handler
40
+     */
41
+    function __construct($db)
42
+    {
43
+        global $conf;
44
+
45
+        $this->db = $db;
46
+        $this->numero = 0;
47
+
48
+        $this->family = "hr";		// Family for module (or "base" if core module)
49
+        $this->module_position = '10';
50
+        // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
51
+        $this->name = preg_replace('/^mod/i','',get_class($this));
52
+        $this->description = "Gestion des utilisateurs (requis)";
53
+
54
+        // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
55
+        $this->version = 'dolibarr';
56
+
57
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
58
+        $this->picto='group';
59
+
60
+        // Data directories to create when module is enabled
61
+        $this->dirs = array("/users/temp");
62
+
63
+        // Config pages
64
+        $this->config_page_url = array("user.php");
65
+
66
+        // Dependencies
67
+        $this->hidden = false;			// A condition to hide module
68
+        $this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
69
+        $this->requiredby = array();	// List of module ids to disable if this one is disabled
70
+        $this->conflictwith = array();	// List of module class names as string this module is in conflict with
71
+        $this->phpmin = array(5,4);		// Minimum version of PHP required by module
72
+        $this->langfiles = array("main","users","companies","members",'salaries');
73
+        $this->always_enabled = true;	// Can't be disabled
74
+
75
+        // Constants
76
+        $this->const = array();
77
+
78
+        // Boxes
79
+        $this->boxes = array(
80
+            0=>array('file'=>'box_lastlogin.php','enabledbydefaulton'=>'Home'),
81
+        );
82
+
83
+        // Permissions
84
+        $this->rights = array();
85
+        $this->rights_class = 'user';
86
+        $this->rights_admin_allowed = 1;	// Admin is always granted of permission (even when module is disabled)
87
+        $r=0;
88
+
89
+        $r++;
90
+        $this->rights[$r][0] = 251;
91
+        $this->rights[$r][1] = 'Consulter les autres utilisateurs';
92
+        $this->rights[$r][2] = 'r';
93
+        $this->rights[$r][3] = 0;
94
+        $this->rights[$r][4] = 'user';
95
+        $this->rights[$r][5] = 'lire';
96
+
97
+        $r++;
98
+        $this->rights[$r][0] = 252;
99
+        $this->rights[$r][1] = 'Consulter les permissions des autres utilisateurs';
100
+        $this->rights[$r][2] = 'r';
101
+        $this->rights[$r][3] = 0;
102
+        $this->rights[$r][4] = 'user_advance';
103
+        $this->rights[$r][5] = 'readperms';
104
+
105
+        $r++;
106
+        $this->rights[$r][0] = 253;
107
+        $this->rights[$r][1] = 'Creer/modifier utilisateurs internes et externes';
108
+        $this->rights[$r][2] = 'w';
109
+        $this->rights[$r][3] = 0;
110
+        $this->rights[$r][4] = 'user';
111
+        $this->rights[$r][5] = 'creer';
112
+
113
+        $r++;
114
+        $this->rights[$r][0] = 254;
115
+        $this->rights[$r][1] = 'Creer/modifier utilisateurs externes seulement';
116
+        $this->rights[$r][2] = 'w';
117
+        $this->rights[$r][3] = 0;
118
+        $this->rights[$r][4] = 'user_advance';
119
+        $this->rights[$r][5] = 'write';
120
+
121
+        $r++;
122
+        $this->rights[$r][0] = 255;
123
+        $this->rights[$r][1] = 'Modifier le mot de passe des autres utilisateurs';
124
+        $this->rights[$r][2] = 'w';
125
+        $this->rights[$r][3] = 0;
126
+        $this->rights[$r][4] = 'user';
127
+        $this->rights[$r][5] = 'password';
128
+
129
+        $r++;
130
+        $this->rights[$r][0] = 256;
131
+        $this->rights[$r][1] = 'Supprimer ou desactiver les autres utilisateurs';
132
+        $this->rights[$r][2] = 'd';
133
+        $this->rights[$r][3] = 0;
134
+        $this->rights[$r][4] = 'user';
135
+        $this->rights[$r][5] = 'supprimer';
136
+
137
+        $r++;
138
+        $this->rights[$r][0] = 341;
139
+        $this->rights[$r][1] = 'Consulter ses propres permissions';
140
+        $this->rights[$r][2] = 'r';
141
+        $this->rights[$r][3] = 0;
142
+        $this->rights[$r][4] = 'self_advance';        // Visible if option MAIN_USE_ADVANCED_PERMS is on
143
+        $this->rights[$r][5] = 'readperms';
144
+
145
+        $r++;
146
+        $this->rights[$r][0] = 342;
147
+        $this->rights[$r][1] = 'Creer/modifier ses propres infos utilisateur';
148
+        $this->rights[$r][2] = 'w';
149
+        $this->rights[$r][3] = 0;
150
+        $this->rights[$r][4] = 'self';
151
+        $this->rights[$r][5] = 'creer';
152
+
153
+        $r++;
154
+        $this->rights[$r][0] = 343;
155
+        $this->rights[$r][1] = 'Modifier son propre mot de passe';
156
+        $this->rights[$r][2] = 'w';
157
+        $this->rights[$r][3] = 0;
158
+        $this->rights[$r][4] = 'self';
159
+        $this->rights[$r][5] = 'password';
160
+
161
+        $r++;
162
+        $this->rights[$r][0] = 344;
163
+        $this->rights[$r][1] = 'Modifier ses propres permissions';
164
+        $this->rights[$r][2] = 'w';
165
+        $this->rights[$r][3] = 0;
166
+        $this->rights[$r][4] = 'self_advance';          // Visible if option MAIN_USE_ADVANCED_PERMS is on
167
+        $this->rights[$r][5] = 'writeperms';
168
+
169
+        $r++;
170
+        $this->rights[$r][0] = 351;
171
+        $this->rights[$r][1] = 'Consulter les groupes';
172
+        $this->rights[$r][2] = 'r';
173
+        $this->rights[$r][3] = 0;
174
+        $this->rights[$r][4] = 'group_advance';        // Visible if option MAIN_USE_ADVANCED_PERMS is on
175
+        $this->rights[$r][5] = 'read';
176
+
177
+        $r++;
178
+        $this->rights[$r][0] = 352;
179
+        $this->rights[$r][1] = 'Consulter les permissions des groupes';
180
+        $this->rights[$r][2] = 'r';
181
+        $this->rights[$r][3] = 0;
182
+        $this->rights[$r][4] = 'group_advance';       // Visible if option MAIN_USE_ADVANCED_PERMS is on
183
+        $this->rights[$r][5] = 'readperms';
184
+
185
+        $r++;
186
+        $this->rights[$r][0] = 353;
187
+        $this->rights[$r][1] = 'Creer/modifier les groupes et leurs permissions';
188
+        $this->rights[$r][2] = 'w';
189
+        $this->rights[$r][3] = 0;
190
+        $this->rights[$r][4] = 'group_advance';      // Visible if option MAIN_USE_ADVANCED_PERMS is on
191
+        $this->rights[$r][5] = 'write';
192
+
193
+        $r++;
194
+        $this->rights[$r][0] = 354;
195
+        $this->rights[$r][1] = 'Supprimer ou desactiver les groupes';
196
+        $this->rights[$r][2] = 'd';
197
+        $this->rights[$r][3] = 0;
198
+        $this->rights[$r][4] = 'group_advance';      // Visible if option MAIN_USE_ADVANCED_PERMS is on
199
+        $this->rights[$r][5] = 'delete';
200
+
201
+        $r++;
202
+        $this->rights[$r][0] = 358;
203
+        $this->rights[$r][1] = 'Exporter les utilisateurs';
204
+        $this->rights[$r][2] = 'r';
205
+        $this->rights[$r][3] = 0;
206
+        $this->rights[$r][4] = 'user';
207
+        $this->rights[$r][5] = 'export';
208 208
 
209 209
 
210 210
         // Menus
211 211
         $this->menu = 1;        // This module add menu entries. They are coded into menu manager.
212 212
 
213 213
 
214
-		// Exports
215
-		$r=0;
216
-
217
-		$r++;
218
-		$this->export_code[$r]=$this->rights_class.'_'.$r;
219
-		$this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs';
220
-		$this->export_permission[$r]=array(array("user","user","export"));
221
-		$this->export_fields_array[$r]=array(
222
-			'u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.accountancy_code'=>"UserAccountancyCode",
223
-			'u.office_phone'=>'Phone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",
224
-			'u.admin'=>"Administrator",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion',
225
-			'u.fk_socpeople'=>"IdContact",'u.fk_soc'=>"IdCompany",'u.fk_member'=>"MemberId"
226
-		);
227
-		$this->export_TypeFields_array[$r]=array(
228
-			'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.accountancy_code'=>'Text','u.office_phone'=>'Text','u.office_fax'=>'Text',
229
-			'u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date',
230
-			'u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname"
231
-		);
232
-		$this->export_entities_array[$r]=array(
233
-			'u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.accountancy_code'=>'user','u.office_phone'=>'user',
234
-			'u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",
235
-			'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member"
236
-		);
214
+        // Exports
215
+        $r=0;
216
+
217
+        $r++;
218
+        $this->export_code[$r]=$this->rights_class.'_'.$r;
219
+        $this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs';
220
+        $this->export_permission[$r]=array(array("user","user","export"));
221
+        $this->export_fields_array[$r]=array(
222
+            'u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.accountancy_code'=>"UserAccountancyCode",
223
+            'u.office_phone'=>'Phone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",
224
+            'u.admin'=>"Administrator",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion',
225
+            'u.fk_socpeople'=>"IdContact",'u.fk_soc'=>"IdCompany",'u.fk_member'=>"MemberId"
226
+        );
227
+        $this->export_TypeFields_array[$r]=array(
228
+            'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.accountancy_code'=>'Text','u.office_phone'=>'Text','u.office_fax'=>'Text',
229
+            'u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date',
230
+            'u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname"
231
+        );
232
+        $this->export_entities_array[$r]=array(
233
+            'u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.accountancy_code'=>'user','u.office_phone'=>'user',
234
+            'u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",
235
+            'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member"
236
+        );
237 237
         if (empty($conf->adherent->enabled))
238 238
         {
239 239
             unset($this->export_fields_array[$r]['u.fk_member']);
240 240
             unset($this->export_entities_array[$r]['u.fk_member']);
241 241
         }
242
-		$this->export_sql_start[$r]='SELECT DISTINCT ';
243
-		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'user as u';
244
-		$this->export_sql_end[$r] .=' WHERE u.entity IN ('.getEntity('user').')';
245
-
246
-		// Imports
247
-		$r=0;
248
-
249
-		// Import list of users attributes
250
-		$r++;
251
-		$this->import_code[$r]=$this->rights_class.'_'.$r;
252
-		$this->import_label[$r]='ImportDataset_user_1';
253
-		$this->import_icon[$r]='user';
254
-		$this->import_entities_array[$r]=array();		// We define here only fields that use another icon that the one defined into import_icon
255
-		$this->import_tables_array[$r]=array('u'=>MAIN_DB_PREFIX.'user','extra'=>MAIN_DB_PREFIX.'user_extrafields');	// List of tables to insert into (insert done in same order)
256
-		$this->import_fields_array[$r]=array(
257
-			'u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"Job",'u.gender'=>"Gender",'u.login'=>"Login*",
258
-			'u.pass_crypted'=>"Password",'u.admin'=>"Administrator",'u.fk_soc'=>"Company*",'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
259
-			'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",
260
-			'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature','u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM',
261
-			'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey','u.datec'=>"DateCreation"
262
-		);
263
-		// Add extra fields
264
-		$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
265
-		$resql=$this->db->query($sql);
266
-		if ($resql)    // This can fail when class is used on old database (during migration for example)
267
-		{
268
-		    while ($obj=$this->db->fetch_object($resql))
269
-		    {
270
-		        $fieldname='extra.'.$obj->name;
271
-		        $fieldlabel=ucfirst($obj->label);
272
-		        $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
273
-		    }
274
-		}
275
-		// End add extra fields
276
-		$this->import_fieldshidden_array[$r]=array('u.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user');    // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
277
-		$this->import_convertvalue_array[$r]=array(
278
-			'u.fk_state'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'),
279
-		    'u.fk_country'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'),
280
-		    'u.salary'=>array('rule'=>'numeric')
281
-		);
282
-		//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
283
-		$this->import_regex_array[$r]=array(
284
-			'u.employee'=>'^[0|1]',
285
-			'u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'
286
-		);
287
-		$this->import_examplevalues_array[$r]=array(
288
-			'u.lastname'=>"Doe",'u.firstname'=>'John','u.login'=>'jdoe','u.employee'=>'0 or 1','u.status'=>"0 (closed) or 1 (active)",
289
-			'u.fk_soc'=>'0 (internal user) or company name (external user)','u.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'u.address'=>"61 jump street",
290
-			'u.zip'=>"123456",'u.town'=>"Big town",'u.fk_country'=>'US, FR, DE...','u.office_phone'=>"0101010101",'u.office_fax'=>"0101010102",
291
-			'u.email'=>"[email protected]",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00"
292
-		);
293
-		$this->import_updatekeys_array[$r]=array('u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>'Login');
294
-	}
242
+        $this->export_sql_start[$r]='SELECT DISTINCT ';
243
+        $this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'user as u';
244
+        $this->export_sql_end[$r] .=' WHERE u.entity IN ('.getEntity('user').')';
245
+
246
+        // Imports
247
+        $r=0;
248
+
249
+        // Import list of users attributes
250
+        $r++;
251
+        $this->import_code[$r]=$this->rights_class.'_'.$r;
252
+        $this->import_label[$r]='ImportDataset_user_1';
253
+        $this->import_icon[$r]='user';
254
+        $this->import_entities_array[$r]=array();		// We define here only fields that use another icon that the one defined into import_icon
255
+        $this->import_tables_array[$r]=array('u'=>MAIN_DB_PREFIX.'user','extra'=>MAIN_DB_PREFIX.'user_extrafields');	// List of tables to insert into (insert done in same order)
256
+        $this->import_fields_array[$r]=array(
257
+            'u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"Job",'u.gender'=>"Gender",'u.login'=>"Login*",
258
+            'u.pass_crypted'=>"Password",'u.admin'=>"Administrator",'u.fk_soc'=>"Company*",'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
259
+            'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",
260
+            'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature','u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM',
261
+            'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey','u.datec'=>"DateCreation"
262
+        );
263
+        // Add extra fields
264
+        $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
265
+        $resql=$this->db->query($sql);
266
+        if ($resql)    // This can fail when class is used on old database (during migration for example)
267
+        {
268
+            while ($obj=$this->db->fetch_object($resql))
269
+            {
270
+                $fieldname='extra.'.$obj->name;
271
+                $fieldlabel=ucfirst($obj->label);
272
+                $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
273
+            }
274
+        }
275
+        // End add extra fields
276
+        $this->import_fieldshidden_array[$r]=array('u.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user');    // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
277
+        $this->import_convertvalue_array[$r]=array(
278
+            'u.fk_state'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'),
279
+            'u.fk_country'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'),
280
+            'u.salary'=>array('rule'=>'numeric')
281
+        );
282
+        //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
283
+        $this->import_regex_array[$r]=array(
284
+            'u.employee'=>'^[0|1]',
285
+            'u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'
286
+        );
287
+        $this->import_examplevalues_array[$r]=array(
288
+            'u.lastname'=>"Doe",'u.firstname'=>'John','u.login'=>'jdoe','u.employee'=>'0 or 1','u.status'=>"0 (closed) or 1 (active)",
289
+            'u.fk_soc'=>'0 (internal user) or company name (external user)','u.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'u.address'=>"61 jump street",
290
+            'u.zip'=>"123456",'u.town'=>"Big town",'u.fk_country'=>'US, FR, DE...','u.office_phone'=>"0101010101",'u.office_fax'=>"0101010102",
291
+            'u.email'=>"[email protected]",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00"
292
+        );
293
+        $this->import_updatekeys_array[$r]=array('u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>'Login');
294
+    }
295 295
 
296 296
 
297 297
     /**
298
-	 *		Function called when module is enabled.
299
-	 *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
300
-	 *		It also creates data directories
301
-	 *
298
+     *		Function called when module is enabled.
299
+     *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
300
+     *		It also creates data directories
301
+     *
302 302
      *      @param      string	$options    Options when enabling module ('', 'noboxes')
303
-	 *      @return     int             	1 if OK, 0 if KO
303
+     *      @return     int             	1 if OK, 0 if KO
304 304
      */
305
-	function init($options='')
306
-	{
307
-		global $conf;
305
+    function init($options='')
306
+    {
307
+        global $conf;
308 308
 
309
-		// Permissions
310
-		$this->remove($options);
309
+        // Permissions
310
+        $this->remove($options);
311 311
 
312
-		$sql = array();
312
+        $sql = array();
313 313
 
314
-		return $this->_init($sql,$options);
315
-	}
314
+        return $this->_init($sql,$options);
315
+    }
316 316
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -263,11 +263,13 @@
 block discarded – undo
263 263
 		// Add extra fields
264 264
 		$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
265 265
 		$resql=$this->db->query($sql);
266
-		if ($resql)    // This can fail when class is used on old database (during migration for example)
266
+		if ($resql) {
267
+		    // This can fail when class is used on old database (during migration for example)
267 268
 		{
268 269
 		    while ($obj=$this->db->fetch_object($resql))
269 270
 		    {
270 271
 		        $fieldname='extra.'.$obj->name;
272
+		}
271 273
 		        $fieldlabel=ucfirst($obj->label);
272 274
 		        $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
273 275
 		    }
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  */
28 28
 
29 29
 //include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
30
-include_once DOL_BASE_PATH . '/core/modules/DolibarrModules.class.php';
30
+include_once DOL_BASE_PATH.'/core/modules/DolibarrModules.class.php';
31 31
 
32 32
 /**
33 33
  *	Class to describe and enable module User
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
 		$this->db = $db;
48 48
 		$this->numero = 0;
49 49
 
50
-		$this->family = "hr";		// Family for module (or "base" if core module)
50
+		$this->family = "hr"; // Family for module (or "base" if core module)
51 51
 		$this->module_position = '10';
52 52
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53
-		$this->name = preg_replace('/^mod/i','',get_class($this));
53
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
54 54
 		$this->description = "Gestion des utilisateurs (requis)";
55 55
 
56 56
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57 57
 		$this->version = 'dolibarr';
58 58
 
59 59
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
60
-		$this->picto='group';
60
+		$this->picto = 'group';
61 61
 
62 62
 		// Data directories to create when module is enabled
63 63
 		$this->dirs = array("/users/temp");
@@ -66,27 +66,27 @@  discard block
 block discarded – undo
66 66
 		$this->config_page_url = array("user.php");
67 67
 
68 68
 		// Dependencies
69
-		$this->hidden = false;			// A condition to hide module
70
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
71
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
72
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
73
-		$this->phpmin = array(5,4);		// Minimum version of PHP required by module
74
-		$this->langfiles = array("main","users","companies","members",'salaries');
75
-		$this->always_enabled = true;	// Can't be disabled
69
+		$this->hidden = false; // A condition to hide module
70
+		$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
71
+		$this->requiredby = array(); // List of module ids to disable if this one is disabled
72
+		$this->conflictwith = array(); // List of module class names as string this module is in conflict with
73
+		$this->phpmin = array(5, 4); // Minimum version of PHP required by module
74
+		$this->langfiles = array("main", "users", "companies", "members", 'salaries');
75
+		$this->always_enabled = true; // Can't be disabled
76 76
 
77 77
 		// Constants
78 78
 		$this->const = array();
79 79
 
80 80
 		// Boxes
81 81
 		$this->boxes = array(
82
-		    0=>array('file'=>'box_lastlogin.php','enabledbydefaulton'=>'Home'),
82
+		    0=>array('file'=>'box_lastlogin.php', 'enabledbydefaulton'=>'Home'),
83 83
 		);
84 84
 
85 85
 		// Permissions
86 86
 		$this->rights = array();
87 87
 		$this->rights_class = 'user';
88
-		$this->rights_admin_allowed = 1;	// Admin is always granted of permission (even when module is disabled)
89
-		$r=0;
88
+		$this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled)
89
+		$r = 0;
90 90
 
91 91
 		$r++;
92 92
 		$this->rights[$r][0] = 251;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		$this->rights[$r][1] = 'Consulter ses propres permissions';
142 142
 		$this->rights[$r][2] = 'r';
143 143
 		$this->rights[$r][3] = 0;
144
-		$this->rights[$r][4] = 'self_advance';        // Visible if option MAIN_USE_ADVANCED_PERMS is on
144
+		$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
145 145
 		$this->rights[$r][5] = 'readperms';
146 146
 
147 147
 		$r++;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		$this->rights[$r][1] = 'Modifier ses propres permissions';
166 166
 		$this->rights[$r][2] = 'w';
167 167
 		$this->rights[$r][3] = 0;
168
-		$this->rights[$r][4] = 'self_advance';          // Visible if option MAIN_USE_ADVANCED_PERMS is on
168
+		$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
169 169
 		$this->rights[$r][5] = 'writeperms';
170 170
 
171 171
 		$r++;
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		$this->rights[$r][1] = 'Consulter les groupes';
174 174
 		$this->rights[$r][2] = 'r';
175 175
 		$this->rights[$r][3] = 0;
176
-		$this->rights[$r][4] = 'group_advance';        // Visible if option MAIN_USE_ADVANCED_PERMS is on
176
+		$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
177 177
 		$this->rights[$r][5] = 'read';
178 178
 
179 179
 		$r++;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		$this->rights[$r][1] = 'Consulter les permissions des groupes';
182 182
 		$this->rights[$r][2] = 'r';
183 183
 		$this->rights[$r][3] = 0;
184
-		$this->rights[$r][4] = 'group_advance';       // Visible if option MAIN_USE_ADVANCED_PERMS is on
184
+		$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
185 185
 		$this->rights[$r][5] = 'readperms';
186 186
 
187 187
 		$r++;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		$this->rights[$r][1] = 'Creer/modifier les groupes et leurs permissions';
190 190
 		$this->rights[$r][2] = 'w';
191 191
 		$this->rights[$r][3] = 0;
192
-		$this->rights[$r][4] = 'group_advance';      // Visible if option MAIN_USE_ADVANCED_PERMS is on
192
+		$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
193 193
 		$this->rights[$r][5] = 'write';
194 194
 
195 195
 		$r++;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$this->rights[$r][1] = 'Supprimer ou desactiver les groupes';
198 198
 		$this->rights[$r][2] = 'd';
199 199
 		$this->rights[$r][3] = 0;
200
-		$this->rights[$r][4] = 'group_advance';      // Visible if option MAIN_USE_ADVANCED_PERMS is on
200
+		$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
201 201
 		$this->rights[$r][5] = 'delete';
202 202
 
203 203
 		$r++;
@@ -210,89 +210,89 @@  discard block
 block discarded – undo
210 210
 
211 211
 
212 212
         // Menus
213
-        $this->menu = 1;        // This module add menu entries. They are coded into menu manager.
213
+        $this->menu = 1; // This module add menu entries. They are coded into menu manager.
214 214
 
215 215
 
216 216
 		// Exports
217
-		$r=0;
217
+		$r = 0;
218 218
 
219 219
 		$r++;
220
-		$this->export_code[$r]=$this->rights_class.'_'.$r;
221
-		$this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs';
222
-		$this->export_permission[$r]=array(array("user","user","export"));
223
-		$this->export_fields_array[$r]=array(
224
-			'u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.accountancy_code'=>"UserAccountancyCode",
225
-			'u.office_phone'=>'Phone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",
226
-			'u.admin'=>"Administrator",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion',
227
-			'u.fk_socpeople'=>"IdContact",'u.fk_soc'=>"IdCompany",'u.fk_member'=>"MemberId"
220
+		$this->export_code[$r] = $this->rights_class.'_'.$r;
221
+		$this->export_label[$r] = 'Liste des utilisateurs Dolibarr et attributs';
222
+		$this->export_permission[$r] = array(array("user", "user", "export"));
223
+		$this->export_fields_array[$r] = array(
224
+			'u.rowid'=>"Id", 'u.login'=>"Login", 'u.lastname'=>"Lastname", 'u.firstname'=>"Firstname", 'u.accountancy_code'=>"UserAccountancyCode",
225
+			'u.office_phone'=>'Phone', 'u.office_fax'=>'Fax', 'u.email'=>'EMail', 'u.datec'=>"DateCreation", 'u.tms'=>"DateLastModification",
226
+			'u.admin'=>"Administrator", 'u.statut'=>'Status', 'u.note'=>"Note", 'u.datelastlogin'=>'LastConnexion', 'u.datepreviouslogin'=>'PreviousConnexion',
227
+			'u.fk_socpeople'=>"IdContact", 'u.fk_soc'=>"IdCompany", 'u.fk_member'=>"MemberId"
228 228
 		);
229
-		$this->export_TypeFields_array[$r]=array(
230
-			'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.accountancy_code'=>'Text','u.office_phone'=>'Text','u.office_fax'=>'Text',
231
-			'u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date',
232
-			'u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname"
229
+		$this->export_TypeFields_array[$r] = array(
230
+			'u.login'=>"Text", 'u.lastname'=>"Text", 'u.firstname'=>"Text", 'u.accountancy_code'=>'Text', 'u.office_phone'=>'Text', 'u.office_fax'=>'Text',
231
+			'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.datelastlogin'=>'Date',
232
+			'u.datepreviouslogin'=>'Date', 'u.fk_soc'=>"List:societe:nom:rowid", 'u.fk_member'=>"List:adherent:firstname"
233 233
 		);
234
-		$this->export_entities_array[$r]=array(
235
-			'u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.accountancy_code'=>'user','u.office_phone'=>'user',
236
-			'u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",
237
-			'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member"
234
+		$this->export_entities_array[$r] = array(
235
+			'u.rowid'=>"user", 'u.login'=>"user", 'u.lastname'=>"user", 'u.firstname'=>"user", 'u.accountancy_code'=>'user', 'u.office_phone'=>'user',
236
+			'u.office_fax'=>'user', 'u.email'=>'user', 'u.datec'=>"user", 'u.tms'=>"user", 'u.admin'=>"user", 'u.statut'=>'user', 'u.note'=>"user",
237
+			'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user', 'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member"
238 238
 		);
239 239
         if (empty($conf->adherent->enabled))
240 240
         {
241 241
             unset($this->export_fields_array[$r]['u.fk_member']);
242 242
             unset($this->export_entities_array[$r]['u.fk_member']);
243 243
         }
244
-		$this->export_sql_start[$r]='SELECT DISTINCT ';
245
-		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'user as u';
246
-		$this->export_sql_end[$r] .=' WHERE u.entity IN ('.getEntity('user').')';
244
+		$this->export_sql_start[$r] = 'SELECT DISTINCT ';
245
+		$this->export_sql_end[$r]  = ' FROM '.MAIN_DB_PREFIX.'user as u';
246
+		$this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')';
247 247
 
248 248
 		// Imports
249
-		$r=0;
249
+		$r = 0;
250 250
 
251 251
 		// Import list of users attributes
252 252
 		$r++;
253
-		$this->import_code[$r]=$this->rights_class.'_'.$r;
254
-		$this->import_label[$r]='ImportDataset_user_1';
255
-		$this->import_icon[$r]='user';
256
-		$this->import_entities_array[$r]=array();		// We define here only fields that use another icon that the one defined into import_icon
257
-		$this->import_tables_array[$r]=array('u'=>MAIN_DB_PREFIX.'user','extra'=>MAIN_DB_PREFIX.'user_extrafields');	// List of tables to insert into (insert done in same order)
258
-		$this->import_fields_array[$r]=array(
259
-			'u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"Job",'u.gender'=>"Gender",'u.login'=>"Login*",
260
-			'u.pass_crypted'=>"Password",'u.admin'=>"Administrator",'u.fk_soc'=>"Company*",'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
261
-			'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",
262
-			'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature','u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM',
263
-			'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey','u.datec'=>"DateCreation"
253
+		$this->import_code[$r] = $this->rights_class.'_'.$r;
254
+		$this->import_label[$r] = 'ImportDataset_user_1';
255
+		$this->import_icon[$r] = 'user';
256
+		$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
257
+		$this->import_tables_array[$r] = array('u'=>MAIN_DB_PREFIX.'user', 'extra'=>MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order)
258
+		$this->import_fields_array[$r] = array(
259
+			'u.lastname'=>"Name*", 'u.firstname'=>"Firstname", 'u.employee'=>"Employee*", 'u.job'=>"Job", 'u.gender'=>"Gender", 'u.login'=>"Login*",
260
+			'u.pass_crypted'=>"Password", 'u.admin'=>"Administrator", 'u.fk_soc'=>"Company*", 'u.address'=>"Address", 'u.zip'=>"Zip", 'u.town'=>"Town",
261
+			'u.fk_state'=>"StateId", 'u.fk_country'=>"CountryCode", 'u.office_phone'=>"Phone", 'u.user_mobile'=>"Mobile", 'u.office_fax'=>"Fax",
262
+			'u.email'=>"Email", 'u.note'=>"Note", 'u.signature'=>'Signature', 'u.fk_user'=>'Supervisor', 'u.thm'=>'THM', 'u.tjm'=>'TJM',
263
+			'u.dateemployment'=>'DateEmployment', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey', 'u.datec'=>"DateCreation"
264 264
 		);
265 265
 		// Add extra fields
266
-		$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
267
-		$resql=$this->db->query($sql);
266
+		$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
267
+		$resql = $this->db->query($sql);
268 268
 		if ($resql)    // This can fail when class is used on old database (during migration for example)
269 269
 		{
270
-		    while ($obj=$this->db->fetch_object($resql))
270
+		    while ($obj = $this->db->fetch_object($resql))
271 271
 		    {
272
-		        $fieldname='extra.'.$obj->name;
273
-		        $fieldlabel=ucfirst($obj->label);
274
-		        $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
272
+		        $fieldname = 'extra.'.$obj->name;
273
+		        $fieldlabel = ucfirst($obj->label);
274
+		        $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
275 275
 		    }
276 276
 		}
277 277
 		// End add extra fields
278
-		$this->import_fieldshidden_array[$r]=array('u.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user');    // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
279
-		$this->import_convertvalue_array[$r]=array(
280
-			'u.fk_state'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'),
281
-		    'u.fk_country'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'),
278
+		$this->import_fieldshidden_array[$r] = array('u.fk_user_creat'=>'user->id', 'extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
279
+		$this->import_convertvalue_array[$r] = array(
280
+			'u.fk_state'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/cstate.class.php', 'class'=>'Cstate', 'method'=>'fetch', 'dict'=>'DictionaryState'),
281
+		    'u.fk_country'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/ccountry.class.php', 'class'=>'Ccountry', 'method'=>'fetch', 'dict'=>'DictionaryCountry'),
282 282
 		    'u.salary'=>array('rule'=>'numeric')
283 283
 		);
284 284
 		//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
285
-		$this->import_regex_array[$r]=array(
285
+		$this->import_regex_array[$r] = array(
286 286
 			'u.employee'=>'^[0|1]',
287 287
 			'u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'
288 288
 		);
289
-		$this->import_examplevalues_array[$r]=array(
290
-			'u.lastname'=>"Doe",'u.firstname'=>'John','u.login'=>'jdoe','u.employee'=>'0 or 1','u.status'=>"0 (closed) or 1 (active)",
291
-			'u.fk_soc'=>'0 (internal user) or company name (external user)','u.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'u.address'=>"61 jump street",
292
-			'u.zip'=>"123456",'u.town'=>"Big town",'u.fk_country'=>'US, FR, DE...','u.office_phone'=>"0101010101",'u.office_fax'=>"0101010102",
293
-			'u.email'=>"[email protected]",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00"
289
+		$this->import_examplevalues_array[$r] = array(
290
+			'u.lastname'=>"Doe", 'u.firstname'=>'John', 'u.login'=>'jdoe', 'u.employee'=>'0 or 1', 'u.status'=>"0 (closed) or 1 (active)",
291
+			'u.fk_soc'=>'0 (internal user) or company name (external user)', 'u.datec'=>dol_print_date(dol_now(), '%Y-%m-%d'), 'u.address'=>"61 jump street",
292
+			'u.zip'=>"123456", 'u.town'=>"Big town", 'u.fk_country'=>'US, FR, DE...', 'u.office_phone'=>"0101010101", 'u.office_fax'=>"0101010102",
293
+			'u.email'=>"[email protected]", 'u.salary'=>"10000", 'u.note'=>"This is an example of note for record", 'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00"
294 294
 		);
295
-		$this->import_updatekeys_array[$r]=array('u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>'Login');
295
+		$this->import_updatekeys_array[$r] = array('u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>'Login');
296 296
 	}
297 297
 
298 298
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      *      @param      string	$options    Options when enabling module ('', 'noboxes')
305 305
 	 *      @return     int             	1 if OK, 0 if KO
306 306
      */
307
-	function init($options='')
307
+	function init($options = '')
308 308
 	{
309 309
 		global $conf;
310 310
 
@@ -313,6 +313,6 @@  discard block
 block discarded – undo
313 313
 
314 314
 		$sql = array();
315 315
 
316
-		return $this->_init($sql,$options);
316
+		return $this->_init($sql, $options);
317 317
 	}
318 318
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modWebServicesClient.class.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 {
32 32
 
33 33
     /**
34
-	 *   Constructor. Define names, constants, directories, boxes, permissions
35
-	 *
36
-	 *   @param      DoliDB		$db      Database handler
34
+     *   Constructor. Define names, constants, directories, boxes, permissions
35
+     *
36
+     *   @param      DoliDB		$db      Database handler
37 37
      */
38 38
     function __construct($db)
39 39
     {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
45 45
         $this->name = preg_replace('/^mod/i','',get_class($this));
46 46
         $this->description = "Enable the web service client to call external supplier web services";
47
-		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
47
+        // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
48 48
         $this->version = 'experimental';
49 49
         // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
50 50
         $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 
60 60
         // Dependencies
61 61
         $this->hidden = false;			// A condition to hide module
62
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
63
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
64
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
65
-		$this->phpmin = array(5,4);		// Minimum version of PHP required by module
62
+        $this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
63
+        $this->requiredby = array();	// List of module ids to disable if this one is disabled
64
+        $this->conflictwith = array();	// List of module class names as string this module is in conflict with
65
+        $this->phpmin = array(5,4);		// Minimum version of PHP required by module
66 66
         $this->langfiles = array("other");
67 67
 
68 68
         // Constants
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  *       \ingroup    webservices
23 23
  *       \brief      File to describe client for supplier webservices module
24 24
  */
25
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
25
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
26 26
 
27 27
 /**
28 28
  *	Class to describe a sync supplier web services module
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 
43 43
         $this->family = "interface";
44 44
         // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
45
-        $this->name = preg_replace('/^mod/i','',get_class($this));
45
+        $this->name = preg_replace('/^mod/i', '', get_class($this));
46 46
         $this->description = "Enable the web service client to call external supplier web services";
47 47
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
48 48
         $this->version = 'experimental';
49 49
         // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
50 50
         $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
51 51
         // Name of image file used for this module.
52
-        $this->picto='technic';
52
+        $this->picto = 'technic';
53 53
 
54 54
         // Data directories to create when module is enabled
55 55
         $this->dirs = array();
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
         //$this->config_page_url = array();
59 59
 
60 60
         // Dependencies
61
-        $this->hidden = false;			// A condition to hide module
62
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
63
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
64
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
65
-		$this->phpmin = array(5,4);		// Minimum version of PHP required by module
61
+        $this->hidden = false; // A condition to hide module
62
+		$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
63
+		$this->requiredby = array(); // List of module ids to disable if this one is disabled
64
+		$this->conflictwith = array(); // List of module class names as string this module is in conflict with
65
+		$this->phpmin = array(5, 4); // Minimum version of PHP required by module
66 66
         $this->langfiles = array("other");
67 67
 
68 68
         // Constants
@@ -77,6 +77,6 @@  discard block
 block discarded – undo
77 77
         // Permissions
78 78
         $this->rights = array();
79 79
         $this->rights_class = 'syncsupplierwebservices';
80
-        $r=0;
80
+        $r = 0;
81 81
     }
82 82
 }
Please login to merge, or discard this patch.