@@ -18,13 +18,27 @@ |
||
18 | 18 | * Library javascript to enable Browser notifications |
19 | 19 | */ |
20 | 20 | |
21 | -if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); |
|
22 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
23 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
24 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
25 | -if (!defined('NOLOGIN')) define('NOLOGIN', 1); |
|
26 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); |
|
27 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); |
|
21 | +if (!defined('NOREQUIREUSER')) { |
|
22 | + define('NOREQUIREUSER', '1'); |
|
23 | +} |
|
24 | +if (!defined('NOREQUIRESOC')) { |
|
25 | + define('NOREQUIRESOC', '1'); |
|
26 | +} |
|
27 | +if (!defined('NOCSRFCHECK')) { |
|
28 | + define('NOCSRFCHECK', 1); |
|
29 | +} |
|
30 | +if (!defined('NOTOKENRENEWAL')) { |
|
31 | + define('NOTOKENRENEWAL', 1); |
|
32 | +} |
|
33 | +if (!defined('NOLOGIN')) { |
|
34 | + define('NOLOGIN', 1); |
|
35 | +} |
|
36 | +if (!defined('NOREQUIREMENU')) { |
|
37 | + define('NOREQUIREMENU', 1); |
|
38 | +} |
|
39 | +if (!defined('NOREQUIREHTML')) { |
|
40 | + define('NOREQUIREHTML', 1); |
|
41 | +} |
|
28 | 42 | |
29 | 43 | require_once '../../main.inc.php'; |
30 | 44 |
@@ -30,17 +30,17 @@ |
||
30 | 30 | require_once '../../main.inc.php'; |
31 | 31 | |
32 | 32 | if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/index.php' |
33 | - || preg_match('/getmenu_div\.php/', $_SERVER['HTTP_REFERER']))) |
|
33 | + || preg_match('/getmenu_div\.php/', $_SERVER['HTTP_REFERER']))) |
|
34 | 34 | { |
35 | - global $langs, $conf; |
|
35 | + global $langs, $conf; |
|
36 | 36 | |
37 | - top_httphead('text/javascript; charset=UTF-8'); |
|
37 | + top_httphead('text/javascript; charset=UTF-8'); |
|
38 | 38 | |
39 | - print 'var login = \''.$_SESSION['dol_login'].'\';'."\n"; |
|
39 | + print 'var login = \''.$_SESSION['dol_login'].'\';'."\n"; |
|
40 | 40 | print 'var nowtime = Date.now();'; |
41 | - print 'var time_auto_update = '.$conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY.';'."\n"; // Always defined |
|
42 | - print 'var time_js_next_test;'."\n"; |
|
43 | - ?> |
|
41 | + print 'var time_auto_update = '.$conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY.';'."\n"; // Always defined |
|
42 | + print 'var time_js_next_test;'."\n"; |
|
43 | + ?> |
|
44 | 44 | |
45 | 45 | /* Check if permission ok */ |
46 | 46 | if (Notification.permission !== "granted") { |
@@ -133,9 +133,15 @@ |
||
133 | 133 | global $langs; |
134 | 134 | $langs->load("admin"); |
135 | 135 | |
136 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
137 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
138 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
136 | + if ($this->version == 'development') { |
|
137 | + return $langs->trans("VersionDevelopment"); |
|
138 | + } |
|
139 | + if ($this->version == 'experimental') { |
|
140 | + return $langs->trans("VersionExperimental"); |
|
141 | + } |
|
142 | + if ($this->version == 'dolibarr') { |
|
143 | + return DOL_VERSION; |
|
144 | + } |
|
139 | 145 | return $langs->trans("NotAvailable"); |
140 | 146 | } |
141 | 147 | } |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | public $error = ''; |
39 | 39 | |
40 | 40 | |
41 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
41 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
42 | 42 | /** |
43 | 43 | * Return list of active generation modules |
44 | 44 | * |
45 | - * @param DoliDB $db Database handler |
|
46 | - * @param integer $maxfilenamelength Max length of value to show |
|
47 | - * @return array List of templates |
|
48 | - */ |
|
49 | - public static function liste_modeles($db, $maxfilenamelength = 0) |
|
45 | + * @param DoliDB $db Database handler |
|
46 | + * @param integer $maxfilenamelength Max length of value to show |
|
47 | + * @return array List of templates |
|
48 | + */ |
|
49 | + public static function liste_modeles($db, $maxfilenamelength = 0) |
|
50 | 50 | { |
51 | - // phpcs:enable |
|
51 | + // phpcs:enable |
|
52 | 52 | global $conf; |
53 | 53 | |
54 | 54 | $type = 'project_task'; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return boolean true if module can be used |
80 | 80 | */ |
81 | - public function isEnabled() |
|
81 | + public function isEnabled() |
|
82 | 82 | { |
83 | 83 | return true; |
84 | 84 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string Texte descripif |
90 | 90 | */ |
91 | - public function info() |
|
91 | + public function info() |
|
92 | 92 | { |
93 | 93 | global $langs; |
94 | 94 | $langs->load("projects"); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return string Example |
102 | 102 | */ |
103 | - public function getExample() |
|
103 | + public function getExample() |
|
104 | 104 | { |
105 | 105 | global $langs; |
106 | 106 | $langs->load("projects"); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return boolean false if conflict, true if ok |
115 | 115 | */ |
116 | - public function canBeActivated() |
|
116 | + public function canBeActivated() |
|
117 | 117 | { |
118 | 118 | return true; |
119 | 119 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param Project $project Object project |
126 | 126 | * @return string Valeur |
127 | 127 | */ |
128 | - public function getNextValue($objsoc, $project) |
|
128 | + public function getNextValue($objsoc, $project) |
|
129 | 129 | { |
130 | 130 | global $langs; |
131 | 131 | return $langs->trans("NotAvailable"); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return string Valeur |
138 | 138 | */ |
139 | - public function getVersion() |
|
139 | + public function getVersion() |
|
140 | 140 | { |
141 | 141 | global $langs; |
142 | 142 | $langs->load("admin"); |
@@ -309,7 +309,9 @@ |
||
309 | 309 | $multicurrency->name = $langs->cache_currencies[$conf->currency]['label'].' ('.$langs->getCurrencySymbol($conf->currency).')'; |
310 | 310 | $r = $multicurrency->create($user); |
311 | 311 | |
312 | - if ($r > 0) $multicurrency->addRate(1); |
|
312 | + if ($r > 0) { |
|
313 | + $multicurrency->addRate(1); |
|
314 | + } |
|
313 | 315 | } |
314 | 316 | } |
315 | 317 | } |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param DoliDB $db Database handler |
40 | 40 | */ |
41 | - public function __construct($db) |
|
42 | - { |
|
43 | - global $langs, $conf; |
|
41 | + public function __construct($db) |
|
42 | + { |
|
43 | + global $langs, $conf; |
|
44 | 44 | |
45 | - $this->db = $db; |
|
45 | + $this->db = $db; |
|
46 | 46 | |
47 | 47 | // Id for module (must be unique). |
48 | 48 | // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | |
102 | 102 | // Array to add new pages in new tabs |
103 | 103 | // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@multicurrency:$user->rights->multicurrency->read:/multicurrency/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 |
104 | - // 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@multicurrency:$user->rights->othermodule->read:/multicurrency/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. |
|
105 | - // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname |
|
104 | + // 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@multicurrency:$user->rights->othermodule->read:/multicurrency/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. |
|
105 | + // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname |
|
106 | 106 | // where objecttype can be |
107 | 107 | // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
108 | 108 | // 'contact' to add a tab in contact view |
@@ -123,16 +123,16 @@ discard block |
||
123 | 123 | // 'stock' to add a tab in stock view |
124 | 124 | // 'thirdparty' to add a tab in third party view |
125 | 125 | // 'user' to add a tab in user view |
126 | - $this->tabs = array(); |
|
127 | - |
|
128 | - // Dictionaries |
|
129 | - if (!isset($conf->multicurrency->enabled)) |
|
130 | - { |
|
131 | - $conf->multicurrency = new stdClass(); |
|
132 | - $conf->multicurrency->enabled = 0; |
|
133 | - } |
|
126 | + $this->tabs = array(); |
|
127 | + |
|
128 | + // Dictionaries |
|
129 | + if (!isset($conf->multicurrency->enabled)) |
|
130 | + { |
|
131 | + $conf->multicurrency = new stdClass(); |
|
132 | + $conf->multicurrency->enabled = 0; |
|
133 | + } |
|
134 | 134 | $this->dictionaries = array(); |
135 | - /* Example: |
|
135 | + /* Example: |
|
136 | 136 | if (! isset($conf->multicurrency->enabled)) $conf->multicurrency->enabled=0; // This is to avoid warnings |
137 | 137 | $this->dictionaries=array( |
138 | 138 | 'langs'=>'mylangfile@multicurrency', |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | ); |
150 | 150 | */ |
151 | 151 | |
152 | - // Boxes |
|
152 | + // Boxes |
|
153 | 153 | // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
154 | - $this->boxes = array(); // List of boxes |
|
154 | + $this->boxes = array(); // List of boxes |
|
155 | 155 | // Example: |
156 | 156 | //$this->boxes=array( |
157 | 157 | // 0=>array('file'=>'myboxa.php@multicurrency','note'=>'','enabledbydefaulton'=>'Home'), |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | // Example: |
216 | 216 | // $this->export_code[$r]=$this->rights_class.'_'.$r; |
217 | 217 | // $this->export_label[$r]='MyModule'; // Translation key (used only if key ExportDataset_xxx_z not found) |
218 | - // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. |
|
219 | - // $this->export_icon[$r]='generic:MyModule'; |
|
218 | + // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. |
|
219 | + // $this->export_icon[$r]='generic:MyModule'; |
|
220 | 220 | // $this->export_permission[$r]=array(array("multicurrency","level1","level2")); |
221 | 221 | // $this->export_fields_array[$r]=array( |
222 | 222 | // 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone', |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
260 | 260 | * It also creates data directories |
261 | 261 | * |
262 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
262 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
263 | 263 | * @return int 1 if OK, 0 if KO |
264 | 264 | */ |
265 | 265 | public function init($options = '') |
@@ -40,7 +40,10 @@ |
||
40 | 40 | <tr> |
41 | 41 | <td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td> |
42 | 42 | <td><input name="ref" size="40" maxlength="32" value="<?php echo $object->ref; ?>"> |
43 | -<?php if ($refalreadyexists == 1) echo $langs->trans("RefAlreadyExists"); ?> |
|
43 | +<?php if ($refalreadyexists == 1) { |
|
44 | + echo $langs->trans("RefAlreadyExists"); |
|
45 | +} |
|
46 | +?> |
|
44 | 47 | </td></tr> |
45 | 48 | |
46 | 49 | <tr> |
@@ -132,8 +132,8 @@ |
||
132 | 132 | |
133 | 133 | if ($action == 'display' || $action == 'delete') { |
134 | 134 | |
135 | - print "<table class='noborder' width='100%'>\n"; |
|
136 | - print '<tr class="liste_titre">'; |
|
135 | + print "<table class='noborder' width='100%'>\n"; |
|
136 | + print '<tr class="liste_titre">'; |
|
137 | 137 | print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>"; |
138 | 138 | print '<td class="liste_titre" colspan="2">'.$langs->trans("Label")."</td>"; |
139 | 139 | print "</tr>\n"; |
@@ -62,8 +62,9 @@ |
||
62 | 62 | if (!empty($selectcpt)) { |
63 | 63 | $cpts = array(); |
64 | 64 | foreach ($selectcpt as $selectedoption) { |
65 | - if (!array_key_exists($selectedoption, $cpts)) |
|
66 | - $cpts[$selectedoption] = "'".$selectedoption."'"; |
|
65 | + if (!array_key_exists($selectedoption, $cpts)) { |
|
66 | + $cpts[$selectedoption] = "'".$selectedoption."'"; |
|
67 | + } |
|
67 | 68 | } |
68 | 69 | |
69 | 70 | $return = $accountingcategory->updateAccAcc($cat_id, $cpts); |
@@ -26,8 +26,9 @@ |
||
26 | 26 | |
27 | 27 | $langs->load("admin"); |
28 | 28 | |
29 | -if (!$user->admin) |
|
29 | +if (!$user->admin) { |
|
30 | 30 | accessforbidden(); |
31 | +} |
|
31 | 32 | |
32 | 33 | /* |
33 | 34 | * View |
@@ -40,7 +40,10 @@ |
||
40 | 40 | <tr> |
41 | 41 | <td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td> |
42 | 42 | <td><input name="ref" size="40" maxlength="32" value="<?php echo $object->ref; ?>"> |
43 | -<?php if ($refalreadyexists == 1) echo $langs->trans("RefAlreadyExists"); ?> |
|
43 | +<?php if ($refalreadyexists == 1) { |
|
44 | + echo $langs->trans("RefAlreadyExists"); |
|
45 | +} |
|
46 | +?> |
|
44 | 47 | </td></tr> |
45 | 48 | |
46 | 49 | <tr> |
@@ -92,10 +92,18 @@ |
||
92 | 92 | global $langs; |
93 | 93 | $langs->load("admin"); |
94 | 94 | |
95 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
96 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
97 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
98 | - if ($this->version) return $this->version; |
|
95 | + if ($this->version == 'development') { |
|
96 | + return $langs->trans("VersionDevelopment"); |
|
97 | + } |
|
98 | + if ($this->version == 'experimental') { |
|
99 | + return $langs->trans("VersionExperimental"); |
|
100 | + } |
|
101 | + if ($this->version == 'dolibarr') { |
|
102 | + return DOL_VERSION; |
|
103 | + } |
|
104 | + if ($this->version) { |
|
105 | + return $this->version; |
|
106 | + } |
|
99 | 107 | return $langs->trans("NotAvailable"); |
100 | 108 | } |
101 | 109 | } |
@@ -42,17 +42,17 @@ |
||
42 | 42 | public $error = ''; |
43 | 43 | |
44 | 44 | |
45 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
45 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
46 | 46 | /** |
47 | 47 | * Return list of active generation modules |
48 | 48 | * |
49 | - * @param DoliDB $db Database handler |
|
50 | - * @param integer $maxfilenamelength Max length of value to show |
|
51 | - * @return array List of templates |
|
49 | + * @param DoliDB $db Database handler |
|
50 | + * @param integer $maxfilenamelength Max length of value to show |
|
51 | + * @return array List of templates |
|
52 | 52 | */ |
53 | 53 | public static function liste_modeles($db, $maxfilenamelength = 0) |
54 | 54 | { |
55 | - // phpcs:enable |
|
55 | + // phpcs:enable |
|
56 | 56 | global $conf; |
57 | 57 | |
58 | 58 | $type = 'propal'; |
@@ -92,10 +92,18 @@ |
||
92 | 92 | global $langs; |
93 | 93 | $langs->load("admin"); |
94 | 94 | |
95 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
96 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
97 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
98 | - if ($this->version) return $this->version; |
|
95 | + if ($this->version == 'development') { |
|
96 | + return $langs->trans("VersionDevelopment"); |
|
97 | + } |
|
98 | + if ($this->version == 'experimental') { |
|
99 | + return $langs->trans("VersionExperimental"); |
|
100 | + } |
|
101 | + if ($this->version == 'dolibarr') { |
|
102 | + return DOL_VERSION; |
|
103 | + } |
|
104 | + if ($this->version) { |
|
105 | + return $this->version; |
|
106 | + } |
|
99 | 107 | return $langs->trans("NotAvailable"); |
100 | 108 | } |
101 | 109 | } |
@@ -43,17 +43,17 @@ |
||
43 | 43 | public $error = ''; |
44 | 44 | |
45 | 45 | |
46 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
46 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
47 | 47 | /** |
48 | 48 | * Return list of active generation modules |
49 | 49 | * |
50 | - * @param DoliDB $db Database handler |
|
51 | - * @param integer $maxfilenamelength Max length of value to show |
|
52 | - * @return array List of templates |
|
50 | + * @param DoliDB $db Database handler |
|
51 | + * @param integer $maxfilenamelength Max length of value to show |
|
52 | + * @return array List of templates |
|
53 | 53 | */ |
54 | - public static function liste_modeles($db, $maxfilenamelength = 0) |
|
54 | + public static function liste_modeles($db, $maxfilenamelength = 0) |
|
55 | 55 | { |
56 | - // phpcs:enable |
|
56 | + // phpcs:enable |
|
57 | 57 | global $conf; |
58 | 58 | |
59 | 59 | $type = 'contract'; |