Passed
Branch develop (92bdcd)
by Laurent
32:39
created
htdocs/salaries/admin/salaries_extrafields.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	print '<div name="topofform"></div><br>';
98 98
 	print load_fiche_titre($langs->trans('NewAttribute'));
99 99
 
100
-    require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
100
+	require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
101 101
 }
102 102
 
103 103
 /* ************************************************************************** */
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	print '<div name="topofform"></div><br>';
111 111
 	print load_fiche_titre($langs->trans("FieldEdition", $attrname));
112 112
 
113
-    require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
113
+	require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
114 114
 }
115 115
 
116 116
 // End of page
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,13 +36,17 @@
 block discarded – undo
36 36
 // List of supported format
37 37
 $tmptype2label = ExtraFields::$type2label;
38 38
 $type2label = array('');
39
-foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
39
+foreach ($tmptype2label as $key => $val) {
40
+	$type2label[$key] = $langs->transnoentitiesnoconv($val);
41
+}
40 42
 
41 43
 $action = GETPOST('action', 'aZ09');
42 44
 $attrname = GETPOST('attrname', 'alpha');
43 45
 $elementtype = 'payment_salary'; //Must be the $table_element of the class that manage extrafield
44 46
 
45
-if (!$user->admin) accessforbidden();
47
+if (!$user->admin) {
48
+	accessforbidden();
49
+}
46 50
 
47 51
 
48 52
 /*
Please login to merge, or discard this patch.
htdocs/product/inventory/lib/inventory.lib.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,30 +29,30 @@
 block discarded – undo
29 29
  */
30 30
 function inventoryAdminPrepareHead()
31 31
 {
32
-    global $langs, $conf;
32
+	global $langs, $conf;
33 33
 
34
-    $langs->load("inventory");
34
+	$langs->load("inventory");
35 35
 
36
-    $h = 0;
37
-    $head = array();
36
+	$h = 0;
37
+	$head = array();
38 38
 
39
-    $head[$h][0] = DOL_URL_ROOT."/admin/inventory.php";
40
-    $head[$h][1] = $langs->trans("Parameters");
41
-    $head[$h][2] = 'settings';
42
-    $h++;
39
+	$head[$h][0] = DOL_URL_ROOT."/admin/inventory.php";
40
+	$head[$h][1] = $langs->trans("Parameters");
41
+	$head[$h][2] = 'settings';
42
+	$h++;
43 43
 
44 44
 
45
-    // Show more tabs from modules
46
-    // Entries must be declared in modules descriptor with line
47
-    //$this->tabs = array(
48
-    //	'entity:+tabname:Title:@inventory:/inventory/mypage.php?id=__ID__'
49
-    //); // to add new tab
50
-    //$this->tabs = array(
51
-    //	'entity:-tabname:Title:@inventory:/inventory/mypage.php?id=__ID__'
52
-    //); // to remove a tab
53
-    complete_head_from_modules($conf, $langs, null, $head, $h, 'inventory');
45
+	// Show more tabs from modules
46
+	// Entries must be declared in modules descriptor with line
47
+	//$this->tabs = array(
48
+	//	'entity:+tabname:Title:@inventory:/inventory/mypage.php?id=__ID__'
49
+	//); // to add new tab
50
+	//$this->tabs = array(
51
+	//	'entity:-tabname:Title:@inventory:/inventory/mypage.php?id=__ID__'
52
+	//); // to remove a tab
53
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'inventory');
54 54
 
55
-    return $head;
55
+	return $head;
56 56
 }
57 57
 
58 58
 /**
Please login to merge, or discard this patch.
htdocs/projet/class/taskstats.class.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 	public $socid;
30 30
 	public $year;
31 31
 
32
-    /**
33
-     * Constructor of the class
34
-     *
35
-     * @param   DoliDb  $db     Database handler
36
-     */
32
+	/**
33
+	 * Constructor of the class
34
+	 *
35
+	 * @param   DoliDb  $db     Database handler
36
+	 */
37 37
 	public function __construct($db)
38 38
 	{
39 39
 		$this->db = $db;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * Return Task number by month for a year
164 164
 	 *
165 165
 	 * @param 	int 	$year 		Year to scan
166
-     * @param	int		$format		0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
166
+	 * @param	int		$format		0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
167 167
 	 * @return 	array 				Array of values
168 168
 	 */
169 169
 	public function getNbByMonth($year, $format = 0)
Please login to merge, or discard this patch.
Braces   +31 added lines, -19 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
 		$sql = "SELECT";
60 60
 		$sql .= " COUNT(t.rowid), t.priority";
61 61
 		$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = t.fk_projet";
62
-		if (!$user->rights->societe->client->voir && !$user->soc_id)
63
-			$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".$user->id;
62
+		if (!$user->rights->societe->client->voir && !$user->soc_id) {
63
+					$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".$user->id;
64
+		}
64 65
 		$sql .= $this->buildWhere();
65 66
 		//$sql .= " AND t.fk_statut <> 0";     // We want historic also, so all task not draft
66 67
 		$sql .= " GROUP BY t.priority";
@@ -82,14 +83,17 @@  discard block
 block discarded – undo
82 83
 						$row[1],
83 84
 						$row[0]
84 85
 					);
85
-				} else $other += $row[1];
86
+				} else {
87
+					$other += $row[1];
88
+				}
86 89
 				$i++;
87 90
 			}
88
-			if ($num > $limit)
89
-				$result[$i] = array(
91
+			if ($num > $limit) {
92
+							$result[$i] = array(
90 93
 						$langs->transnoentitiesnoconv("Other"),
91 94
 						$other
92 95
 				);
96
+			}
93 97
 			$this->db->free($resql);
94 98
 		} else {
95 99
 			$this->error = "Error ".$this->db->lasterror();
@@ -115,8 +119,9 @@  discard block
 block discarded – undo
115 119
 
116 120
 		$sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb";
117 121
 		$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = t.fk_projet";
118
-		if (!$user->rights->societe->client->voir && !$user->soc_id)
119
-			$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".$user->id;
122
+		if (!$user->rights->societe->client->voir && !$user->soc_id) {
123
+					$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".$user->id;
124
+		}
120 125
 		$sql .= $this->buildWhere();
121 126
 		$sql .= " GROUP BY year";
122 127
 		$sql .= $this->db->order('year', 'DESC');
@@ -137,18 +142,24 @@  discard block
 block discarded – undo
137 142
 
138 143
 		$sqlwhere[] = ' t.entity IN ('.getEntity('project').')';
139 144
 
140
-		if (!empty($this->userid))
141
-			$sqlwhere[] = ' t.fk_user_resp='.$this->userid;
145
+		if (!empty($this->userid)) {
146
+					$sqlwhere[] = ' t.fk_user_resp='.$this->userid;
147
+		}
142 148
 		// Forced filter on socid is similar to forced filter on project. TODO Use project assignement to allow to not use filter on project
143
-		if (!empty($this->socid))
144
-			$sqlwhere[] = ' p.fk_soc='.$this->socid; // Link on thirdparty is on project, not on task
145
-		if (!empty($this->year) && empty($this->yearmonth))
146
-			$sqlwhere[] = " date_format(t.datec,'%Y')='".$this->db->escape($this->year)."'";
147
-		if (!empty($this->yearmonth))
148
-			$sqlwhere[] = " t.datec BETWEEN '".$this->db->idate(dol_get_first_day($this->yearmonth))."' AND '".$this->db->idate(dol_get_last_day($this->yearmonth))."'";
149
+		if (!empty($this->socid)) {
150
+					$sqlwhere[] = ' p.fk_soc='.$this->socid;
151
+		}
152
+		// Link on thirdparty is on project, not on task
153
+		if (!empty($this->year) && empty($this->yearmonth)) {
154
+					$sqlwhere[] = " date_format(t.datec,'%Y')='".$this->db->escape($this->year)."'";
155
+		}
156
+		if (!empty($this->yearmonth)) {
157
+					$sqlwhere[] = " t.datec BETWEEN '".$this->db->idate(dol_get_first_day($this->yearmonth))."' AND '".$this->db->idate(dol_get_last_day($this->yearmonth))."'";
158
+		}
149 159
 
150
-		if (!empty($this->status))
151
-			$sqlwhere[] = " t.priority IN (".$this->priority.")";
160
+		if (!empty($this->status)) {
161
+					$sqlwhere[] = " t.priority IN (".$this->priority.")";
162
+		}
152 163
 
153 164
 		if (count($sqlwhere) > 0) {
154 165
 			$sqlwhere_str = ' WHERE '.implode(' AND ', $sqlwhere);
@@ -172,8 +183,9 @@  discard block
 block discarded – undo
172 183
 
173 184
 		$sql = "SELECT date_format(t.datec,'%m') as dm, COUNT(t.rowid) as nb";
174 185
 		$sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = t.fk_projet";
175
-		if (!$user->rights->societe->client->voir && !$user->soc_id)
176
-			$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".$user->id;
186
+		if (!$user->rights->societe->client->voir && !$user->soc_id) {
187
+					$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".$user->id;
188
+		}
177 189
 		$sql .= $this->buildWhere();
178 190
 		$sql .= " GROUP BY dm";
179 191
 		$sql .= $this->db->order('dm', 'DESC');
Please login to merge, or discard this patch.
htdocs/core/modules/modZapier.class.php 2 patches
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -347,7 +347,10 @@
 block discarded – undo
347 347
     public function init($options = '')
348 348
     {
349 349
         $result = $this->_load_tables('/zapier/sql/');
350
-        if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default')
350
+        if ($result < 0) {
351
+        	return -1;
352
+        }
353
+        // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default')
351 354
 
352 355
         // Create extrafields
353 356
         //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
Please login to merge, or discard this patch.
Indentation   +264 added lines, -264 removed lines patch added patch discarded remove patch
@@ -30,159 +30,159 @@  discard block
 block discarded – undo
30 30
  */
31 31
 class modZapier extends DolibarrModules
32 32
 {
33
-    /**
34
-     * Constructor. Define names, constants, directories, boxes, permissions
35
-     *
36
-     * @param DoliDB $db Database handler
37
-     */
38
-    public function __construct($db)
39
-    {
40
-        global $langs, $conf;
33
+	/**
34
+	 * Constructor. Define names, constants, directories, boxes, permissions
35
+	 *
36
+	 * @param DoliDB $db Database handler
37
+	 */
38
+	public function __construct($db)
39
+	{
40
+		global $langs, $conf;
41 41
 
42
-        $this->db = $db;
43
-        // Id for module (must be unique).
44
-        // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
45
-        $this->numero = 50330;
46
-        // Key text used to identify module (for permissions, menus, etc...)
47
-        $this->rights_class = 'zapier';
48
-        // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
49
-        // It is used to group modules by family in module setup page
50
-        $this->family = "interface";
51
-        // Module position in the family on 2 digits ('01', '10', '20', ...)
52
-        $this->module_position = '22';
53
-        // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
54
-        //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
55
-        // Module label (no space allowed), used if translation string 'ModuleZapierName' not found (Zapier is name of module).
56
-        $this->name = preg_replace('/^mod/i', '', get_class($this));
57
-        // Module description, used if translation string 'ModuleZapierDesc' not found (Zapier is name of module).
58
-        $this->description = "ZapierDescription";
59
-        // Used only if file README.md and README-LL.md not found.
60
-        $this->descriptionlong = "Zapier description (Long)";
61
-        // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
62
-        $this->version = 'development';
63
-        //Url to the file with your last numberversion of this module
64
-        //$this->url_last_version = 'http://www.example.com/versionmodule.txt';
65
-        // Key used in llx_const table to save module status enabled/disabled (where ZAPIERFORDOLIBARR is value of property name of module in uppercase)
66
-        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
67
-        // Name of image file used for this module.
68
-        // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
69
-        // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
70
-        $this->picto = 'zapier';
71
-        // Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
72
-        $this->module_parts = array(
73
-            // Set this to 1 if module has its own trigger directory (core/triggers)
74
-            'triggers' => 1,
75
-            // Set this to 1 if module has its own login method file (core/login)
76
-            'login' => 0,
77
-            // Set this to 1 if module has its own substitution function file (core/substitutions)
78
-            'substitutions' => 0,
79
-            // Set this to 1 if module has its own menus handler directory (core/menus)
80
-            'menus' => 0,
81
-            // Set this to 1 if module overwrite template dir (core/tpl)
82
-            'tpl' => 0,
83
-            // Set this to 1 if module has its own barcode directory (core/modules/barcode)
84
-            'barcode' => 0,
85
-            // Set this to 1 if module has its own models directory (core/modules/xxx)
86
-            'models' => 0,
87
-            // Set this to 1 if module has its own theme directory (theme)
88
-            'theme' => 0,
89
-            // Set this to relative path of css file if module has its own css file
90
-            'css' => array(
91
-                //    '/zapier/css/zapier.css.php',
92
-            ),
93
-            // Set this to relative path of js file if module must load a js on all pages
94
-            'js' => array(
95
-                //   '/zapier/js/zapier.js.php',
96
-            ),
97
-            // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all'
98
-            'hooks' => array(
99
-                //   'data' => array(
100
-                //       'hookcontext1',
101
-                //       'hookcontext2',
102
-                //   ),
103
-                //   'entity' => '0',
104
-            ),
105
-            // Set this to 1 if feature of module are opened to external users
106
-            'moduleforexternal' => 0,
107
-        );
108
-        // Data directories to create when module is enabled.
109
-        // Example: this->dirs = array("/zapier/temp","/zapier/subdir");
110
-        $this->dirs = array("/zapier/temp");
111
-        // Config pages. Put here list of php page, stored into zapier/admin directory, to use to setup module.
112
-        $this->config_page_url = array(
113
-        //    "setup.php@zapier"
114
-        );
115
-        // Dependencies
116
-        // A condition to hide module
117
-        $this->hidden = false;
118
-        // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
119
-        $this->depends = array();
120
-        // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
121
-        $this->requiredby = array();
122
-        // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
123
-        $this->conflictwith = array();
124
-        $this->langfiles = array("zapier");
125
-        // Minimum version of PHP required by module
126
-        //$this->phpmin = array(5, 5);
127
-        // Minimum version of Dolibarr required by module
128
-        $this->need_dolibarr_version = array(10, 0);
129
-        // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
130
-        $this->warnings_activation = array();
131
-        // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
132
-        $this->warnings_activation_ext = array();
133
-        // $this->automatic_activation = array(
134
-        //     'FR'=>'ZapierWasAutomaticallyActivatedBecauseOfYourCountryChoice',
135
-        // );
136
-        // If true, can't be disabled
137
-        // $this->always_enabled = true;
138
-        // Constants
139
-        // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
140
-        // Example: $this->const=array(
141
-        //    1 => array('ZAPIERFORDOLIBARR_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
142
-        //    2 => array('ZAPIERFORDOLIBARR_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
143
-        // );
144
-        $this->const = array(
145
-            // 1 => array('ZAPIERFORDOLIBARR_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
146
-        );
147
-        // Some keys to add into the overwriting translation tables
148
-        /*$this->overwrite_translation = array(
42
+		$this->db = $db;
43
+		// Id for module (must be unique).
44
+		// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
45
+		$this->numero = 50330;
46
+		// Key text used to identify module (for permissions, menus, etc...)
47
+		$this->rights_class = 'zapier';
48
+		// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
49
+		// It is used to group modules by family in module setup page
50
+		$this->family = "interface";
51
+		// Module position in the family on 2 digits ('01', '10', '20', ...)
52
+		$this->module_position = '22';
53
+		// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
54
+		//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
55
+		// Module label (no space allowed), used if translation string 'ModuleZapierName' not found (Zapier is name of module).
56
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
57
+		// Module description, used if translation string 'ModuleZapierDesc' not found (Zapier is name of module).
58
+		$this->description = "ZapierDescription";
59
+		// Used only if file README.md and README-LL.md not found.
60
+		$this->descriptionlong = "Zapier description (Long)";
61
+		// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
62
+		$this->version = 'development';
63
+		//Url to the file with your last numberversion of this module
64
+		//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
65
+		// Key used in llx_const table to save module status enabled/disabled (where ZAPIERFORDOLIBARR is value of property name of module in uppercase)
66
+		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
67
+		// Name of image file used for this module.
68
+		// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
69
+		// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
70
+		$this->picto = 'zapier';
71
+		// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
72
+		$this->module_parts = array(
73
+			// Set this to 1 if module has its own trigger directory (core/triggers)
74
+			'triggers' => 1,
75
+			// Set this to 1 if module has its own login method file (core/login)
76
+			'login' => 0,
77
+			// Set this to 1 if module has its own substitution function file (core/substitutions)
78
+			'substitutions' => 0,
79
+			// Set this to 1 if module has its own menus handler directory (core/menus)
80
+			'menus' => 0,
81
+			// Set this to 1 if module overwrite template dir (core/tpl)
82
+			'tpl' => 0,
83
+			// Set this to 1 if module has its own barcode directory (core/modules/barcode)
84
+			'barcode' => 0,
85
+			// Set this to 1 if module has its own models directory (core/modules/xxx)
86
+			'models' => 0,
87
+			// Set this to 1 if module has its own theme directory (theme)
88
+			'theme' => 0,
89
+			// Set this to relative path of css file if module has its own css file
90
+			'css' => array(
91
+				//    '/zapier/css/zapier.css.php',
92
+			),
93
+			// Set this to relative path of js file if module must load a js on all pages
94
+			'js' => array(
95
+				//   '/zapier/js/zapier.js.php',
96
+			),
97
+			// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all'
98
+			'hooks' => array(
99
+				//   'data' => array(
100
+				//       'hookcontext1',
101
+				//       'hookcontext2',
102
+				//   ),
103
+				//   'entity' => '0',
104
+			),
105
+			// Set this to 1 if feature of module are opened to external users
106
+			'moduleforexternal' => 0,
107
+		);
108
+		// Data directories to create when module is enabled.
109
+		// Example: this->dirs = array("/zapier/temp","/zapier/subdir");
110
+		$this->dirs = array("/zapier/temp");
111
+		// Config pages. Put here list of php page, stored into zapier/admin directory, to use to setup module.
112
+		$this->config_page_url = array(
113
+		//    "setup.php@zapier"
114
+		);
115
+		// Dependencies
116
+		// A condition to hide module
117
+		$this->hidden = false;
118
+		// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
119
+		$this->depends = array();
120
+		// List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
121
+		$this->requiredby = array();
122
+		// List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
123
+		$this->conflictwith = array();
124
+		$this->langfiles = array("zapier");
125
+		// Minimum version of PHP required by module
126
+		//$this->phpmin = array(5, 5);
127
+		// Minimum version of Dolibarr required by module
128
+		$this->need_dolibarr_version = array(10, 0);
129
+		// Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
130
+		$this->warnings_activation = array();
131
+		// Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
132
+		$this->warnings_activation_ext = array();
133
+		// $this->automatic_activation = array(
134
+		//     'FR'=>'ZapierWasAutomaticallyActivatedBecauseOfYourCountryChoice',
135
+		// );
136
+		// If true, can't be disabled
137
+		// $this->always_enabled = true;
138
+		// Constants
139
+		// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
140
+		// Example: $this->const=array(
141
+		//    1 => array('ZAPIERFORDOLIBARR_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
142
+		//    2 => array('ZAPIERFORDOLIBARR_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
143
+		// );
144
+		$this->const = array(
145
+			// 1 => array('ZAPIERFORDOLIBARR_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
146
+		);
147
+		// Some keys to add into the overwriting translation tables
148
+		/*$this->overwrite_translation = array(
149 149
             'en_US:ParentCompany'=>'Parent company or reseller',
150 150
             'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
151 151
         )*/
152
-        if (!isset($conf->zapier) || !isset($conf->zapier->enabled)) {
153
-            $conf->zapier = new stdClass();
154
-            $conf->zapier->enabled = 0;
155
-        }
156
-        // Array to add new pages in new tabs
157
-        $this->tabs = array();
158
-        // Example:
159
-        // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@zapier:$user->rights->zapier->read:/zapier/mynewtab1.php?id=__ID__');  					// To add a new tab identified by code tabname1
160
-        // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@zapier:$user->rights->othermodule->read:/zapier/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.
161
-        // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove');                                                     										// To remove an existing tab identified by code tabname
162
-        //
163
-        // Where objecttype can be
164
-        // 'categories_x'	  to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
165
-        // 'contact'          to add a tab in contact view
166
-        // 'contract'         to add a tab in contract view
167
-        // 'group'            to add a tab in group view
168
-        // 'intervention'     to add a tab in intervention view
169
-        // 'invoice'          to add a tab in customer invoice view
170
-        // 'invoice_supplier' to add a tab in supplier invoice view
171
-        // 'member'           to add a tab in fundation member view
172
-        // 'opensurveypoll'	  to add a tab in opensurvey poll view
173
-        // 'order'            to add a tab in customer order view
174
-        // 'order_supplier'   to add a tab in supplier order view
175
-        // 'payment'		  to add a tab in payment view
176
-        // 'payment_supplier' to add a tab in supplier payment view
177
-        // 'product'          to add a tab in product view
178
-        // 'propal'           to add a tab in propal view
179
-        // 'project'          to add a tab in project view
180
-        // 'stock'            to add a tab in stock view
181
-        // 'thirdparty'       to add a tab in third party view
182
-        // 'user'             to add a tab in user view
183
-        // Dictionaries
184
-        $this->dictionaries = array();
185
-        /* Example:
152
+		if (!isset($conf->zapier) || !isset($conf->zapier->enabled)) {
153
+			$conf->zapier = new stdClass();
154
+			$conf->zapier->enabled = 0;
155
+		}
156
+		// Array to add new pages in new tabs
157
+		$this->tabs = array();
158
+		// Example:
159
+		// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@zapier:$user->rights->zapier->read:/zapier/mynewtab1.php?id=__ID__');  					// To add a new tab identified by code tabname1
160
+		// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@zapier:$user->rights->othermodule->read:/zapier/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.
161
+		// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove');                                                     										// To remove an existing tab identified by code tabname
162
+		//
163
+		// Where objecttype can be
164
+		// 'categories_x'	  to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
165
+		// 'contact'          to add a tab in contact view
166
+		// 'contract'         to add a tab in contract view
167
+		// 'group'            to add a tab in group view
168
+		// 'intervention'     to add a tab in intervention view
169
+		// 'invoice'          to add a tab in customer invoice view
170
+		// 'invoice_supplier' to add a tab in supplier invoice view
171
+		// 'member'           to add a tab in fundation member view
172
+		// 'opensurveypoll'	  to add a tab in opensurvey poll view
173
+		// 'order'            to add a tab in customer order view
174
+		// 'order_supplier'   to add a tab in supplier order view
175
+		// 'payment'		  to add a tab in payment view
176
+		// 'payment_supplier' to add a tab in supplier payment view
177
+		// 'product'          to add a tab in product view
178
+		// 'propal'           to add a tab in propal view
179
+		// 'project'          to add a tab in project view
180
+		// 'stock'            to add a tab in stock view
181
+		// 'thirdparty'       to add a tab in third party view
182
+		// 'user'             to add a tab in user view
183
+		// Dictionaries
184
+		$this->dictionaries = array();
185
+		/* Example:
186 186
         $this->dictionaries=array(
187 187
             'langs'=>'mylangfile@zapier',
188 188
             // List of tables we want to see into dictonnary editor
@@ -205,88 +205,88 @@  discard block
 block discarded – undo
205 205
             'tabcond'=>array($conf->zapier->enabled,$conf->zapier->enabled,$conf->zapier->enabled)
206 206
         );
207 207
         */
208
-        // Boxes/Widgets
209
-        // Add here list of php file(s) stored in zapier/core/boxes that contains class to show a widget.
210
-        $this->boxes = array(
211
-            //  0 => array(
212
-            //      'file' => 'zapierwidget1.php@zapier',
213
-            //      'note' => 'Widget provided by Zapier',
214
-            //      'enabledbydefaulton' => 'Home',
215
-            //  ),
216
-            //1=>array('file'=>'zapierwidget2.php@zapier','note'=>'Widget provided by Zapier'),
217
-            //2=>array('file'=>'zapierwidget3.php@zapier','note'=>'Widget provided by Zapier')
218
-        );
219
-        // Cronjobs (List of cron jobs entries to add when module is enabled)
220
-        // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
221
-        $this->cronjobs = array(
222
-            //  0 => array(
223
-            //      'label' => 'MyJob label',
224
-            //      'jobtype' => 'method',
225
-            //      'class' => '/zapier/class/myobject.class.php',
226
-            //      'objectname' => 'MyObject',
227
-            //      'method' => 'doScheduledJob',
228
-            //      'parameters' => '',
229
-            //      'comment' => 'Comment',
230
-            //      'frequency' => 2,
231
-            //      'unitfrequency' => 3600,
232
-            //      'status' => 0,
233
-            //      'test' => '$conf->zapier->enabled',
234
-            //      'priority' => 50,
235
-            //  ),
236
-        );
237
-        // Example: $this->cronjobs=array(
238
-        //    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'=>'$conf->zapier->enabled', 'priority'=>50),
239
-        //    1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->zapier->enabled', 'priority'=>50)
240
-        // );
241
-        // Permissions
242
-        // Permission array used by this module
243
-        $this->rights = array();
208
+		// Boxes/Widgets
209
+		// Add here list of php file(s) stored in zapier/core/boxes that contains class to show a widget.
210
+		$this->boxes = array(
211
+			//  0 => array(
212
+			//      'file' => 'zapierwidget1.php@zapier',
213
+			//      'note' => 'Widget provided by Zapier',
214
+			//      'enabledbydefaulton' => 'Home',
215
+			//  ),
216
+			//1=>array('file'=>'zapierwidget2.php@zapier','note'=>'Widget provided by Zapier'),
217
+			//2=>array('file'=>'zapierwidget3.php@zapier','note'=>'Widget provided by Zapier')
218
+		);
219
+		// Cronjobs (List of cron jobs entries to add when module is enabled)
220
+		// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
221
+		$this->cronjobs = array(
222
+			//  0 => array(
223
+			//      'label' => 'MyJob label',
224
+			//      'jobtype' => 'method',
225
+			//      'class' => '/zapier/class/myobject.class.php',
226
+			//      'objectname' => 'MyObject',
227
+			//      'method' => 'doScheduledJob',
228
+			//      'parameters' => '',
229
+			//      'comment' => 'Comment',
230
+			//      'frequency' => 2,
231
+			//      'unitfrequency' => 3600,
232
+			//      'status' => 0,
233
+			//      'test' => '$conf->zapier->enabled',
234
+			//      'priority' => 50,
235
+			//  ),
236
+		);
237
+		// Example: $this->cronjobs=array(
238
+		//    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'=>'$conf->zapier->enabled', 'priority'=>50),
239
+		//    1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->zapier->enabled', 'priority'=>50)
240
+		// );
241
+		// Permissions
242
+		// Permission array used by this module
243
+		$this->rights = array();
244 244
 
245
-        $r = 0;
246
-        // Permission id (must not be already used)
247
-        $this->rights[$r][0] = $this->numero + $r;
248
-        // Permission label
249
-        $this->rights[$r][1] = 'Read myobject of Zapier';
250
-        // Permission by default for new user (0/1)
251
-        $this->rights[$r][3] = 1;
252
-        // In php code, permission will be checked by test if ($user->rights->zapier->level1->level2)
253
-        $this->rights[$r][4] = 'read';
254
-        // In php code, permission will be checked by test if ($user->rights->zapier->level1->level2)
255
-        $this->rights[$r][5] = '';
256
-        $r++;
257
-        $this->rights[$r][0] = $this->numero + $r;
258
-        $this->rights[$r][1] = 'Create/Update myobject of Zapier';
259
-        $this->rights[$r][3] = 1;
260
-        $this->rights[$r][4] = 'write';
261
-        $this->rights[$r][5] = '';
262
-        $r++;
263
-        $this->rights[$r][0] = $this->numero + $r;
264
-        $this->rights[$r][1] = 'Delete myobject of Zapier';
265
-        $this->rights[$r][3] = 1;
266
-        $this->rights[$r][4] = 'delete';
267
-        $this->rights[$r][5] = '';
245
+		$r = 0;
246
+		// Permission id (must not be already used)
247
+		$this->rights[$r][0] = $this->numero + $r;
248
+		// Permission label
249
+		$this->rights[$r][1] = 'Read myobject of Zapier';
250
+		// Permission by default for new user (0/1)
251
+		$this->rights[$r][3] = 1;
252
+		// In php code, permission will be checked by test if ($user->rights->zapier->level1->level2)
253
+		$this->rights[$r][4] = 'read';
254
+		// In php code, permission will be checked by test if ($user->rights->zapier->level1->level2)
255
+		$this->rights[$r][5] = '';
256
+		$r++;
257
+		$this->rights[$r][0] = $this->numero + $r;
258
+		$this->rights[$r][1] = 'Create/Update myobject of Zapier';
259
+		$this->rights[$r][3] = 1;
260
+		$this->rights[$r][4] = 'write';
261
+		$this->rights[$r][5] = '';
262
+		$r++;
263
+		$this->rights[$r][0] = $this->numero + $r;
264
+		$this->rights[$r][1] = 'Delete myobject of Zapier';
265
+		$this->rights[$r][3] = 1;
266
+		$this->rights[$r][4] = 'delete';
267
+		$this->rights[$r][5] = '';
268 268
 
269
-        // Main menu entries
270
-        $this->menu = array(); // List of menus to add
271
-        $r = 0;
269
+		// Main menu entries
270
+		$this->menu = array(); // List of menus to add
271
+		$r = 0;
272 272
 
273
-        // Add here entries to declare new menus
274
-        // $this->menu[$r++]=array(
275
-        //     'fk_menu' => '',                          // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
276
-        //     'type' => 'top',                          // This is a Top menu entry
277
-        //     'titre' => 'Zapier',
278
-        //     'mainmenu' => 'zapier',
279
-        //     'leftmenu' => '',
280
-        //     'url' => '/zapier/zapierindex.php',
281
-        //     'langs' => 'zapier@zapier',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
282
-        //     'position' => 1000+$r,
283
-        //     'enabled' => '$conf->zapier->enabled',  // Define condition to show or hide menu entry. Use '$conf->zapier->enabled' if entry must be visible if module is enabled.
284
-        //     'perms' => '1',			                // Use 'perms'=>'$user->rights->zapier->level1->level2' if you want your menu with a permission rules
285
-        //     'target' => '',
286
-        //     'user' => 2,				                // 0=Menu for internal users, 1=external users, 2=both
287
-        // );
273
+		// Add here entries to declare new menus
274
+		// $this->menu[$r++]=array(
275
+		//     'fk_menu' => '',                          // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
276
+		//     'type' => 'top',                          // This is a Top menu entry
277
+		//     'titre' => 'Zapier',
278
+		//     'mainmenu' => 'zapier',
279
+		//     'leftmenu' => '',
280
+		//     'url' => '/zapier/zapierindex.php',
281
+		//     'langs' => 'zapier@zapier',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
282
+		//     'position' => 1000+$r,
283
+		//     'enabled' => '$conf->zapier->enabled',  // Define condition to show or hide menu entry. Use '$conf->zapier->enabled' if entry must be visible if module is enabled.
284
+		//     'perms' => '1',			                // Use 'perms'=>'$user->rights->zapier->level1->level2' if you want your menu with a permission rules
285
+		//     'target' => '',
286
+		//     'user' => 2,				                // 0=Menu for internal users, 1=external users, 2=both
287
+		// );
288 288
 
289
-        /*
289
+		/*
290 290
         $this->menu[$r++]=array(
291 291
             'fk_menu'=>'fk_mainmenu=zapier',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
292 292
             'type'=>'left',			                // This is a Left menu entry
@@ -316,44 +316,44 @@  discard block
 block discarded – undo
316 316
             'user'=>2,                              // 0=Menu for internal users, 1=external users, 2=both
317 317
         );
318 318
         */
319
-    }
319
+	}
320 320
 
321
-    /**
322
-     *  Function called when module is enabled.
323
-     *  The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
324
-     *  It also creates data directories
325
-     *
326
-     *  @param      string  $options    Options when enabling module ('', 'noboxes')
327
-     *  @return     int                 1 if OK, 0 if KO
328
-     */
329
-    public function init($options = '')
330
-    {
331
-        $result = $this->_load_tables('/zapier/sql/');
332
-        if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default')
321
+	/**
322
+	 *  Function called when module is enabled.
323
+	 *  The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
324
+	 *  It also creates data directories
325
+	 *
326
+	 *  @param      string  $options    Options when enabling module ('', 'noboxes')
327
+	 *  @return     int                 1 if OK, 0 if KO
328
+	 */
329
+	public function init($options = '')
330
+	{
331
+		$result = $this->_load_tables('/zapier/sql/');
332
+		if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default')
333 333
 
334
-        // Create extrafields
335
-        //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
336
-        //$extrafields = new ExtraFields($this->db);
337
-        //$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1,  3, 'thirdparty',   0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
338
-        //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project',      0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
339
-        //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
340
-        //$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select',  1,  3, 'thirdparty',   0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
341
-        //$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text',    1, 10, 'user',         0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
342
-        $sql = array();
343
-        return $this->_init($sql, $options);
344
-    }
334
+		// Create extrafields
335
+		//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
336
+		//$extrafields = new ExtraFields($this->db);
337
+		//$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1,  3, 'thirdparty',   0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
338
+		//$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project',      0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
339
+		//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
340
+		//$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select',  1,  3, 'thirdparty',   0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
341
+		//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text',    1, 10, 'user',         0, 0, '', '', 1, '', 0, 0, '', '', 'zapier@zapier', '$conf->zapier->enabled');
342
+		$sql = array();
343
+		return $this->_init($sql, $options);
344
+	}
345 345
 
346
-    /**
347
-     *  Function called when module is disabled.
348
-     *  Remove from database constants, boxes and permissions from Dolibarr database.
349
-     *  Data directories are not deleted
350
-     *
351
-     *  @param      string	$options    Options when enabling module ('', 'noboxes')
352
-     *  @return     int                 1 if OK, 0 if KO
353
-     */
354
-    public function remove($options = '')
355
-    {
356
-        $sql = array();
357
-        return $this->_remove($sql, $options);
358
-    }
346
+	/**
347
+	 *  Function called when module is disabled.
348
+	 *  Remove from database constants, boxes and permissions from Dolibarr database.
349
+	 *  Data directories are not deleted
350
+	 *
351
+	 *  @param      string	$options    Options when enabling module ('', 'noboxes')
352
+	 *  @return     int                 1 if OK, 0 if KO
353
+	 */
354
+	public function remove($options = '')
355
+	{
356
+		$sql = array();
357
+		return $this->_remove($sql, $options);
358
+	}
359 359
 }
Please login to merge, or discard this patch.
htdocs/zapier/lib/zapier.lib.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,31 +28,31 @@
 block discarded – undo
28 28
  */
29 29
 function zapierAdminPrepareHead()
30 30
 {
31
-    global $langs, $conf;
31
+	global $langs, $conf;
32 32
 
33
-    $langs->load("zapier@zapier");
33
+	$langs->load("zapier@zapier");
34 34
 
35
-    $h = 0;
36
-    $head = array();
35
+	$h = 0;
36
+	$head = array();
37 37
 
38
-    $head[$h][0] = dol_buildpath("/zapier/admin/setup.php", 1);
39
-    $head[$h][1] = $langs->trans("Settings");
40
-    $head[$h][2] = 'settings';
41
-    $h++;
42
-    $head[$h][0] = dol_buildpath("/zapier/admin/about.php", 1);
43
-    $head[$h][1] = $langs->trans("About");
44
-    $head[$h][2] = 'about';
45
-    $h++;
38
+	$head[$h][0] = dol_buildpath("/zapier/admin/setup.php", 1);
39
+	$head[$h][1] = $langs->trans("Settings");
40
+	$head[$h][2] = 'settings';
41
+	$h++;
42
+	$head[$h][0] = dol_buildpath("/zapier/admin/about.php", 1);
43
+	$head[$h][1] = $langs->trans("About");
44
+	$head[$h][2] = 'about';
45
+	$h++;
46 46
 
47
-    // Show more tabs from modules
48
-    // Entries must be declared in modules descriptor with line
49
-    //$this->tabs = array(
50
-    //	'entity:+tabname:Title:@zapier:/zapier/mypage.php?id=__ID__'
51
-    //); // to add new tab
52
-    //$this->tabs = array(
53
-    //	'entity:-tabname:Title:@zapier:/zapier/mypage.php?id=__ID__'
54
-    //); // to remove a tab
55
-    complete_head_from_modules($conf, $langs, $object, $head, $h, 'zapier');
47
+	// Show more tabs from modules
48
+	// Entries must be declared in modules descriptor with line
49
+	//$this->tabs = array(
50
+	//	'entity:+tabname:Title:@zapier:/zapier/mypage.php?id=__ID__'
51
+	//); // to add new tab
52
+	//$this->tabs = array(
53
+	//	'entity:-tabname:Title:@zapier:/zapier/mypage.php?id=__ID__'
54
+	//); // to remove a tab
55
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'zapier');
56 56
 
57
-    return $head;
57
+	return $head;
58 58
 }
Please login to merge, or discard this patch.
htdocs/zapier/hook_document.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -128,9 +128,9 @@
 block discarded – undo
128 128
 
129 129
 	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
130 130
 
131
-    print '<div class="fichecenter">';
131
+	print '<div class="fichecenter">';
132 132
 
133
-    print '<div class="underbanner clearboth"></div>';
133
+	print '<div class="underbanner clearboth"></div>';
134 134
 	print '<table class="border centpercent">';
135 135
 
136 136
 	// Number of files
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,8 +54,12 @@  discard block
 block discarded – undo
54 54
 $offset = $limit * $page;
55 55
 $pageprev = $page - 1;
56 56
 $pagenext = $page + 1;
57
-if (!$sortorder) $sortorder = "ASC";
58
-if (!$sortfield) $sortfield = "name";
57
+if (!$sortorder) {
58
+	$sortorder = "ASC";
59
+}
60
+if (!$sortfield) {
61
+	$sortfield = "name";
62
+}
59 63
 //if (! $sortfield) $sortfield="position_name";
60 64
 
61 65
 // Initialize technical objects
@@ -71,7 +75,9 @@  discard block
 block discarded – undo
71 75
 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
72 76
 
73 77
 //if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/myobject/" . dol_sanitizeFileName($object->id);
74
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity]."/myobject/".dol_sanitizeFileName($object->ref);
78
+if ($id > 0 || !empty($ref)) {
79
+	$upload_dir = $conf->sellyoursaas->multidir_output[$object->entity]."/myobject/".dol_sanitizeFileName($object->ref);
80
+}
75 81
 
76 82
 
77 83
 /*
Please login to merge, or discard this patch.
htdocs/core/modules/security/generate/modGeneratePassPerso.class.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -215,7 +215,9 @@
 block discarded – undo
215 215
     {
216 216
 		$last = "";
217 217
 
218
-		if (empty($this->NbRepeat)) return 1;
218
+		if (empty($this->NbRepeat)) {
219
+			return 1;
220
+		}
219 221
 
220 222
 		$count = 0;
221 223
 		$char = str_split($password);
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 	public $WithoutAmbi;
48 48
 
49 49
 	/**
50
-     * @var DoliDB Database handler.
51
-     */
52
-    public $db;
50
+	 * @var DoliDB Database handler.
51
+	 */
52
+	public $db;
53 53
 
54 54
 	public $conf;
55 55
 	public $lang;
@@ -145,22 +145,22 @@  discard block
 block discarded – undo
145 145
 	{
146 146
 		$pass = "";
147 147
 		for ($i = 0; $i < $this->NbMaj; $i++) {
148
-            // Y
148
+			// Y
149 149
 			$pass .= $this->Maj[mt_rand(0, strlen($this->Maj) - 1)];
150 150
 		}
151 151
 
152 152
 		for ($i = 0; $i < $this->NbNum; $i++) {
153
-            // X
153
+			// X
154 154
 			$pass .= $this->Nb[mt_rand(0, strlen($this->Nb) - 1)];
155 155
 		}
156 156
 
157 157
 		for ($i = 0; $i < $this->NbSpe; $i++) {
158
-            // @
158
+			// @
159 159
 			$pass .= $this->Spe[mt_rand(0, strlen($this->Spe) - 1)];
160 160
 		}
161 161
 
162 162
 		for ($i = strlen($pass); $i < $this->length2; $i++) {
163
-            // y
163
+			// y
164 164
 			$pass .= $this->All[mt_rand(0, strlen($this->All) - 1)];
165 165
 		}
166 166
 
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 	 *  @param		string	$password	Password to check
212 212
 	 *  @return     bool
213 213
 	 */
214
-    private function consecutiveInterationSameCharacter($password)
215
-    {
214
+	private function consecutiveInterationSameCharacter($password)
215
+	{
216 216
 		$last = "";
217 217
 
218 218
 		if (empty($this->NbRepeat)) return 1;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 				continue;
229 229
 			}
230 230
 
231
-            $count++;
231
+			$count++;
232 232
 			if ($count > $this->NbRepeat) {
233 233
 				return false;
234 234
 			}
Please login to merge, or discard this patch.
htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php 2 patches
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,10 +53,12 @@  discard block
 block discarded – undo
53 53
 $offset = $limit * $page;
54 54
 $pageprev = $page - 1;
55 55
 $pagenext = $page + 1;
56
-if ($sortorder == "")
56
+if ($sortorder == "") {
57 57
 	$sortorder = "ASC";
58
-if ($sortfield == "")
58
+}
59
+if ($sortfield == "") {
59 60
 	$sortfield = "bk.doc_date";
61
+}
60 62
 
61 63
 /*
62 64
 $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
@@ -247,7 +249,9 @@  discard block
 block discarded – undo
247 249
 	$solde = 0;
248 250
 	$tmp = '';
249 251
 	while ($obj = $db->fetch_object($resql)) {
250
-		if ($tmp != $obj->lettering_code || empty($tmp))						$tmp = $obj->lettering_code;
252
+		if ($tmp != $obj->lettering_code || empty($tmp)) {
253
+			$tmp = $obj->lettering_code;
254
+		}
251 255
 		/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/	$solde += ($obj->credit - $obj->debit);
252 256
 
253 257
 		print '<tr class="oddeven">';
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -193,17 +193,17 @@  discard block
 block discarded – undo
193 193
 	$num = $db->num_rows($resql);
194 194
 	$i = 0;
195 195
 
196
-    $param = "&socid=".$socid;
196
+	$param = "&socid=".$socid;
197 197
 	print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
198
-    print '<input type="hidden" name="token" value="'.newToken().'">';
198
+	print '<input type="hidden" name="token" value="'.newToken().'">';
199 199
 	print '<input type="hidden" name="socid" value="'.$object->id.'">';
200 200
 
201
-    $letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
201
+	$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
202 202
 
203
-    print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
203
+	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
204 204
 
205
-    print '<div class="div-table-responsive-no-min">';
206
-    print '<table class="liste centpercent">'."\n";
205
+	print '<div class="div-table-responsive-no-min">';
206
+	print '<table class="liste centpercent">'."\n";
207 207
 
208 208
 	/*
209 209
     print '<tr class="liste_titre">';
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
243 243
 	print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
244 244
 	print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
245
-    print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
245
+	print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
246 246
 	print "</tr>\n";
247 247
 
248 248
 	$solde = 0;
@@ -261,21 +261,21 @@  discard block
 block discarded – undo
261 261
 		print '<td class="nowrap right">'.price($obj->credit).'</td>';
262 262
 		print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
263 263
 
264
-        // Journal
265
-        $accountingjournal = new AccountingJournal($db);
266
-        $result = $accountingjournal->fetch('', $obj->code_journal);
267
-        $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
268
-        print '<td class="center">'.$journaltoshow.'</td>';
264
+		// Journal
265
+		$accountingjournal = new AccountingJournal($db);
266
+		$result = $accountingjournal->fetch('', $obj->code_journal);
267
+		$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
268
+		print '<td class="center">'.$journaltoshow.'</td>';
269 269
 
270 270
 		if (empty($obj->lettering_code) && empty($obj->date_validated)) {
271 271
 			print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
272
-		    print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
273
-		    print img_edit();
274
-            print '</a></td>'."\n";
272
+			print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
273
+			print img_edit();
274
+			print '</a></td>'."\n";
275 275
 		} else {
276
-            print '<td class="center">'.$obj->lettering_code.'</td>';
277
-            print '<td></td>';
278
-        }
276
+			print '<td class="center">'.$obj->lettering_code.'</td>';
277
+			print '<td></td>';
278
+		}
279 279
 
280 280
 		print "</tr>\n";
281 281
 	}
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
 
297 297
 	print "</table>";
298 298
 
299
-    print '<div class="tabsAction tabsActionNoBottom">'."\n";
299
+	print '<div class="tabsAction tabsActionNoBottom">'."\n";
300 300
 	print $letteringbutton;
301
-    print '</div>';
301
+	print '</div>';
302 302
 
303 303
 	print "</form>";
304 304
 	$db->free($resql);
Please login to merge, or discard this patch.
htdocs/admin/const.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
 // Add logic to show/hide buttons
164 164
 if ($conf->use_javascript_ajax)
165 165
 {
166
-    ?>
166
+	?>
167 167
 <script type="text/javascript">
168 168
 jQuery(document).ready(function() {
169 169
 	jQuery("#updateconst").hide();
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,8 +30,9 @@  discard block
 block discarded – undo
30 30
 // Load translation files required by the page
31 31
 $langs->load("admin");
32 32
 
33
-if (!$user->admin)
33
+if (!$user->admin) {
34 34
 	accessforbidden();
35
+}
35 36
 
36 37
 $rowid = GETPOST('rowid', 'int');
37 38
 $entity = GETPOST('entity', 'int');
@@ -53,8 +54,12 @@  discard block
 block discarded – undo
53 54
 $offset = $limit * $page;
54 55
 $pageprev = $page - 1;
55 56
 $pagenext = $page + 1;
56
-if (empty($sortfield)) $sortfield = 'entity,name';
57
-if (empty($sortorder)) $sortorder = 'ASC';
57
+if (empty($sortfield)) {
58
+	$sortfield = 'entity,name';
59
+}
60
+if (empty($sortorder)) {
61
+	$sortorder = 'ASC';
62
+}
58 63
 
59 64
 
60 65
 /*
@@ -107,7 +112,9 @@  discard block
 block discarded – undo
107 112
 			}
108 113
 		}
109 114
 	}
110
-	if ($nbmodified > 0) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
115
+	if ($nbmodified > 0) {
116
+		setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
117
+	}
111 118
 	$action = '';
112 119
 }
113 120
 
@@ -117,17 +124,21 @@  discard block
 block discarded – undo
117 124
 	$nbdeleted = 0;
118 125
 	foreach ($consts as $const)
119 126
 	{
120
-		if (!empty($const["check"]))	// Is checkbox checked
127
+		if (!empty($const["check"])) {
128
+			// Is checkbox checked
121 129
 		{
122 130
 			if (dolibarr_del_const($db, $const["rowid"], -1) >= 0)
123 131
 			{
124 132
 				$nbdeleted++;
133
+		}
125 134
 			} else {
126 135
 				dol_print_error($db);
127 136
 			}
128 137
 		}
129 138
 	}
130
-	if ($nbdeleted > 0) setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
139
+	if ($nbdeleted > 0) {
140
+		setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
141
+	}
131 142
 	$action = '';
132 143
 }
133 144
 
@@ -243,8 +254,13 @@  discard block
 block discarded – undo
243 254
 $sql .= " FROM ".MAIN_DB_PREFIX."const";
244 255
 $sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
245 256
 if ((empty($user->entity) || $user->admin) && $debug) {} 										// to force for superadmin to debug
246
-elseif (!GETPOST('visible') || GETPOST('visible') != 'all') $sql .= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
247
-if (GETPOST('name')) $sql .= natural_search("name", GETPOST('name'));
257
+elseif (!GETPOST('visible') || GETPOST('visible') != 'all') {
258
+	$sql .= " AND visible = 1";
259
+}
260
+// We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
261
+if (GETPOST('name')) {
262
+	$sql .= natural_search("name", GETPOST('name'));
263
+}
248 264
 $sql .= $db->order($sortfield, $sortorder);
249 265
 
250 266
 dol_syslog("Const::listConstant", LOG_DEBUG);
Please login to merge, or discard this patch.