Passed
Pull Request — master (#2)
by
unknown
26:19
created
dolibarr/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		global $langs, $db, $conf;
120 120
 
121 121
 		// Load translation files required by the page
122
-        $langs->loadLangs(array("members","other","users","mails"));
122
+        $langs->loadLangs(array("members", "other", "users", "mails"));
123 123
 
124 124
 		require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
125 125
 		$stripe = new Stripe($db);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 		$service = 'StripeTest';
132 132
 		$servicestatus = 0;
133
-		if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha'))
133
+		if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha'))
134 134
 		{
135 135
 			$service = 'StripeLive';
136 136
 			$servicestatus = 1;
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 
139 139
 		// If customer is linked to Stripe, we update/delete Stripe too
140 140
 		if ($action == 'COMPANY_MODIFY') {
141
-			dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
141
+			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
142 142
 
143
-			$stripeacc = $stripe->getStripeAccount($service);	// No need of network access for this. May return '' if no Oauth defined.
143
+			$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined.
144 144
 
145 145
 			if ($object->client != 0) {
146
-				$customer = $stripe->customerStripe($object, $stripeacc, $servicestatus);	// This make a network request
146
+				$customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); // This make a network request
147 147
 				if ($customer)
148 148
 				{
149 149
 					$namecleaned = $object->name ? $object->name : null;
@@ -155,22 +155,22 @@  discard block
 block discarded – undo
155 155
 						$taxinfo["tax_id"] = $vatcleaned;
156 156
 					}
157 157
 					// We force data to "null" if not defined as expected by Stripe
158
-					if (empty($vatcleaned)) $taxinfo=null;
158
+					if (empty($vatcleaned)) $taxinfo = null;
159 159
 
160 160
 					// Detect if we change a Stripe info (email, description, vat id)
161 161
 					$changerequested = 0;
162
-					if (! empty($object->email) && $object->email != $customer->email) $changerequested++;
162
+					if (!empty($object->email) && $object->email != $customer->email) $changerequested++;
163 163
 					if ($namecleaned != $customer->description) $changerequested++;
164
-					if (! isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned)) $changerequested++;
164
+					if (!isset($customer->tax_info['tax_id']) && !is_null($vatcleaned)) $changerequested++;
165 165
 					elseif (isset($customer->tax_info['tax_id']) && is_null($vatcleaned)) $changerequested++;
166
-					elseif (isset($customer->tax_info['tax_id']) && ! is_null($vatcleaned))
166
+					elseif (isset($customer->tax_info['tax_id']) && !is_null($vatcleaned))
167 167
 					{
168 168
 						if ($vatcleaned != $customer->tax_info['tax_id']) $changerequested++;
169 169
 					}
170 170
 
171 171
 					if ($changerequested)
172 172
 					{
173
-						if (! empty($object->email)) $customer->email = $object->email;
173
+						if (!empty($object->email)) $customer->email = $object->email;
174 174
 						$customer->description = $namecleaned;
175 175
 						if (empty($taxinfo)) $customer->tax_info = array('type'=>'vat', 'tax_id'=>null);
176 176
 						else $customer->tax_info = $taxinfo;
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 			}
182 182
 		}
183 183
 		if ($action == 'COMPANY_DELETE') {
184
-			dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
184
+			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
185 185
 
186
-			$stripeacc = $stripe->getStripeAccount($service);	// No need of network access for this. May return '' if no Oauth defined.
186
+			$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined.
187 187
 
188 188
 			$customer = $stripe->customerStripe($object, $stripeacc, $servicestatus);
189 189
 			if ($customer)
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 			}
193 193
 
194 194
 			$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account";
195
-			$sql.= " WHERE site='stripe' AND fk_soc = " . $object->id;
195
+			$sql .= " WHERE site='stripe' AND fk_soc = ".$object->id;
196 196
 			$this->db->query($sql);
197 197
 		}
198 198
 
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
 			// For creation of credit card, we do not create in Stripe automatically
203 203
 		}
204 204
 		if ($action == 'COMPANYPAYMENTMODE_MODIFY' && $object->type == 'card') {
205
-			dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
205
+			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
206 206
 
207
-			if (! empty($object->stripe_card_ref))
207
+			if (!empty($object->stripe_card_ref))
208 208
 			{
209
-				$stripeacc = $stripe->getStripeAccount($service);				// No need of network access for this. May return '' if no Oauth defined.
210
-				$stripecu = $stripe->getStripeCustomerAccount($object->fk_soc);	// No need of network access for this
209
+				$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined.
210
+				$stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this
211 211
 
212 212
 				if ($stripecu)
213 213
 				{
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 					{
223 223
 						$card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus);
224 224
 						if ($card) {
225
-							$card->metadata=array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']));
225
+							$card->metadata = array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']));
226 226
 							try {
227 227
 								$card->save($dataforcard);
228 228
 							}
229
-							catch(Exception $e)
229
+							catch (Exception $e)
230 230
 							{
231 231
 								$ok = -1;
232 232
 								$this->error = $e->getMessages();
@@ -237,12 +237,12 @@  discard block
 block discarded – undo
237 237
 			}
238 238
 		}
239 239
 		if ($action == 'COMPANYPAYMENTMODE_DELETE' && $object->type == 'card') {
240
-			dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
240
+			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
241 241
 
242
-			if (! empty($object->stripe_card_ref))
242
+			if (!empty($object->stripe_card_ref))
243 243
 			{
244
-				$stripeacc = $stripe->getStripeAccount($service);				// No need of network access for this. May return '' if no Oauth defined.
245
-				$stripecu = $stripe->getStripeCustomerAccount($object->fk_soc);	// No need of network access for this
244
+				$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined.
245
+				$stripecu = $stripe->getStripeCustomerAccount($object->fk_soc); // No need of network access for this
246 246
 
247 247
 				if ($stripecu)
248 248
 				{
Please login to merge, or discard this patch.
htdocs/core/triggers/interface_50_modNotification_Notification.class.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	public $picto = 'email';
46 46
 
47 47
 	// @TODO Defined also into notify.class.php)
48
-	public $listofmanagedevents=array(
48
+	public $listofmanagedevents = array(
49 49
 		'BILL_VALIDATE',
50 50
 		'BILL_PAYED',
51 51
 		'ORDER_VALIDATE',
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
78 78
 	{
79
-		if (empty($conf->notification->enabled)) return 0;     // Module not active, we do nothing
79
+		if (empty($conf->notification->enabled)) return 0; // Module not active, we do nothing
80 80
 
81
-		require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
81
+		require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
82 82
 		$notify = new Notify($this->db);
83 83
 
84
-		if (! in_array($action, $notify->arrayofnotifsupported)) return 0;
84
+		if (!in_array($action, $notify->arrayofnotifsupported)) return 0;
85 85
 
86 86
 		dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
87 87
 
@@ -100,42 +100,42 @@  discard block
 block discarded – undo
100 100
 	{
101 101
 		global $conf;
102 102
 
103
-		$ret=array();
103
+		$ret = array();
104 104
 
105 105
 		$sql = "SELECT rowid, code, label, description, elementtype";
106
-		$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger";
107
-		$sql.= $this->db->order("rang, elementtype, code");
106
+		$sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger";
107
+		$sql .= $this->db->order("rang, elementtype, code");
108 108
 		dol_syslog("getListOfManagedEvents Get list of notifications", LOG_DEBUG);
109
-		$resql=$this->db->query($sql);
109
+		$resql = $this->db->query($sql);
110 110
 		if ($resql)
111 111
 		{
112
-			$num=$this->db->num_rows($resql);
113
-			$i=0;
112
+			$num = $this->db->num_rows($resql);
113
+			$i = 0;
114 114
 			while ($i < $num)
115 115
 			{
116
-				$obj=$this->db->fetch_object($resql);
116
+				$obj = $this->db->fetch_object($resql);
117 117
 
118
-				$qualified=0;
118
+				$qualified = 0;
119 119
 				// Check is this event is supported by notification module
120
-				if (in_array($obj->code, $this->listofmanagedevents)) $qualified=1;
120
+				if (in_array($obj->code, $this->listofmanagedevents)) $qualified = 1;
121 121
 				// Check if module for this event is active
122 122
 				if ($qualified)
123 123
 				{
124 124
 					//print 'xx'.$obj->code;
125
-					$element=$obj->elementtype;
125
+					$element = $obj->elementtype;
126 126
 
127 127
 					// Exclude events if related module is disabled
128
-					if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) $qualified=0;
129
-					elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) $qualified=0;
130
-					elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) $qualified=0;
131
-					elseif ($element == 'shipping' && empty($conf->expedition->enabled)) $qualified=0;
132
-					elseif ($element == 'member' && empty($conf->adherent->enabled)) $qualified=0;
133
-					elseif (! in_array($element,array('order_supplier','invoice_supplier','withdraw','shipping','member','expensereport')) && empty($conf->$element->enabled)) $qualified=0;
128
+					if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) $qualified = 0;
129
+					elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) $qualified = 0;
130
+					elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) $qualified = 0;
131
+					elseif ($element == 'shipping' && empty($conf->expedition->enabled)) $qualified = 0;
132
+					elseif ($element == 'member' && empty($conf->adherent->enabled)) $qualified = 0;
133
+					elseif (!in_array($element, array('order_supplier', 'invoice_supplier', 'withdraw', 'shipping', 'member', 'expensereport')) && empty($conf->$element->enabled)) $qualified = 0;
134 134
 				}
135 135
 
136 136
 				if ($qualified)
137 137
 				{
138
-					$ret[]=array('rowid'=>$obj->rowid,'code'=>$obj->code,'label'=>$obj->label,'description'=>$obj->description,'elementtype'=>$obj->elementtype);
138
+					$ret[] = array('rowid'=>$obj->rowid, 'code'=>$obj->code, 'label'=>$obj->label, 'description'=>$obj->description, 'elementtype'=>$obj->elementtype);
139 139
 				}
140 140
 
141 141
 				$i++;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php 1 patch
Spacing   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
60 60
 	{
61
-		if (empty($conf->ldap->enabled)) return 0;		// Module not active, we do nothing
62
-		if (defined('DISABLE_LDAP_SYNCHRO')) return 0;	// If constant defined, we do nothing
61
+		if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing
62
+		if (defined('DISABLE_LDAP_SYNCHRO')) return 0; // If constant defined, we do nothing
63 63
 
64
-		if (! function_exists('ldap_connect'))
64
+		if (!function_exists('ldap_connect'))
65 65
 		{
66 66
 			dol_syslog("Warning, module LDAP is enabled but LDAP functions not available in this PHP", LOG_WARNING);
67 67
 			return 0;
@@ -70,102 +70,102 @@  discard block
 block discarded – undo
70 70
 		require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php";
71 71
 		require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php";
72 72
 
73
-		$result=0;
73
+		$result = 0;
74 74
 
75 75
 		// Users
76 76
 		if ($action == 'USER_CREATE')
77 77
 		{
78 78
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
79
-			if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
79
+			if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
80 80
 			{
81
-				$ldap=new Ldap();
82
-				$result=$ldap->connect_bind();
81
+				$ldap = new Ldap();
82
+				$result = $ldap->connect_bind();
83 83
 
84 84
 				if ($result > 0)
85 85
 				{
86
-					$info=$object->_load_ldap_info();
87
-					$dn=$object->_load_ldap_dn($info);
86
+					$info = $object->_load_ldap_info();
87
+					$dn = $object->_load_ldap_dn($info);
88 88
 
89
-					$result=$ldap->add($dn,$info,$user);
89
+					$result = $ldap->add($dn, $info, $user);
90 90
 				}
91 91
 
92
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
92
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
93 93
 			}
94 94
 		}
95 95
 		elseif ($action == 'USER_MODIFY')
96 96
 		{
97 97
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
98
-			if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
98
+			if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
99 99
 			{
100
-				$ldap=new Ldap();
101
-				$result=$ldap->connect_bind();
100
+				$ldap = new Ldap();
101
+				$result = $ldap->connect_bind();
102 102
 
103 103
 				if ($result > 0)
104 104
 				{
105
-					if (empty($object->oldcopy) || ! is_object($object->oldcopy))
105
+					if (empty($object->oldcopy) || !is_object($object->oldcopy))
106 106
 					{
107 107
 						dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
108 108
 						$object->oldcopy = clone $object;
109 109
 					}
110 110
 
111
-					$oldinfo=$object->oldcopy->_load_ldap_info();
112
-					$olddn=$object->oldcopy->_load_ldap_dn($oldinfo);
111
+					$oldinfo = $object->oldcopy->_load_ldap_info();
112
+					$olddn = $object->oldcopy->_load_ldap_dn($oldinfo);
113 113
 
114 114
 					// Verify if entry exist
115
-					$container=$object->oldcopy->_load_ldap_dn($oldinfo,1);
116
-					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")";
117
-					$records=$ldap->search($container,$search);
115
+					$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
116
+					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
117
+					$records = $ldap->search($container, $search);
118 118
 					if (count($records) && $records['count'] == 0)
119 119
 					{
120 120
 						$olddn = '';
121 121
 					}
122 122
 
123
-					$info=$object->_load_ldap_info();
124
-					$dn=$object->_load_ldap_dn($info);
125
-					$newrdn=$object->_load_ldap_dn($info,2);
126
-					$newparent=$object->_load_ldap_dn($info,1);
123
+					$info = $object->_load_ldap_info();
124
+					$dn = $object->_load_ldap_dn($info);
125
+					$newrdn = $object->_load_ldap_dn($info, 2);
126
+					$newparent = $object->_load_ldap_dn($info, 1);
127 127
 
128
-					$result=$ldap->update($dn,$info,$user,$olddn,$newrdn,$newparent);
128
+					$result = $ldap->update($dn, $info, $user, $olddn, $newrdn, $newparent);
129 129
 				}
130 130
 
131
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
131
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
132 132
 			}
133 133
 		}
134 134
 		elseif ($action == 'USER_NEW_PASSWORD')
135 135
 		{
136 136
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
137
-			if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
137
+			if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
138 138
 			{
139
-				$ldap=new Ldap();
140
-				$result=$ldap->connect_bind();
139
+				$ldap = new Ldap();
140
+				$result = $ldap->connect_bind();
141 141
 
142 142
 				if ($result > 0)
143 143
 				{
144
-					if (empty($object->oldcopy) || ! is_object($object->oldcopy))
144
+					if (empty($object->oldcopy) || !is_object($object->oldcopy))
145 145
 					{
146 146
 						dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
147 147
 						$object->oldcopy = clone $object;
148 148
 					}
149 149
 
150
-					$oldinfo=$object->oldcopy->_load_ldap_info();
151
-					$olddn=$object->oldcopy->_load_ldap_dn($oldinfo);
150
+					$oldinfo = $object->oldcopy->_load_ldap_info();
151
+					$olddn = $object->oldcopy->_load_ldap_dn($oldinfo);
152 152
 
153 153
 					// Verify if entry exist
154
-					$container=$object->oldcopy->_load_ldap_dn($oldinfo,1);
155
-					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")";
156
-					$records=$ldap->search($container,$search);
154
+					$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
155
+					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
156
+					$records = $ldap->search($container, $search);
157 157
 					if (count($records) && $records['count'] == 0)
158 158
 					{
159 159
 						$olddn = '';
160 160
 					}
161 161
 
162
-					$info=$object->_load_ldap_info();
163
-					$dn=$object->_load_ldap_dn($info);
162
+					$info = $object->_load_ldap_info();
163
+					$dn = $object->_load_ldap_dn($info);
164 164
 
165
-					$result=$ldap->update($dn,$info,$user,$olddn);
165
+					$result = $ldap->update($dn, $info, $user, $olddn);
166 166
 				}
167 167
 
168
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
168
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
169 169
 			}
170 170
 		}
171 171
 		elseif ($action == 'USER_ENABLEDISABLE')
@@ -175,96 +175,96 @@  discard block
 block discarded – undo
175 175
 		elseif ($action == 'USER_DELETE')
176 176
 		{
177 177
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
178
-			if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
178
+			if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
179 179
 			{
180
-				$ldap=new Ldap();
181
-				$result=$ldap->connect_bind();
180
+				$ldap = new Ldap();
181
+				$result = $ldap->connect_bind();
182 182
 
183 183
 				if ($result > 0)
184 184
 				{
185
-					$info=$object->_load_ldap_info();
186
-					$dn=$object->_load_ldap_dn($info);
185
+					$info = $object->_load_ldap_info();
186
+					$dn = $object->_load_ldap_dn($info);
187 187
 
188
-					$result=$ldap->delete($dn);
188
+					$result = $ldap->delete($dn);
189 189
 				}
190 190
 
191
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
191
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
192 192
 			}
193 193
 		}
194 194
 		elseif ($action == 'USER_SETINGROUP')
195 195
 		{
196 196
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
197
-			if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
197
+			if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
198 198
 			{
199
-				$ldap=new Ldap();
200
-				$result=$ldap->connect_bind();
199
+				$ldap = new Ldap();
200
+				$result = $ldap->connect_bind();
201 201
 
202 202
 				if ($result > 0)
203 203
 				{
204 204
 					// Must edit $object->newgroupid
205
-					$usergroup=new UserGroup($this->db);
205
+					$usergroup = new UserGroup($this->db);
206 206
 					if ($object->newgroupid > 0)
207 207
 					{
208 208
 						$usergroup->fetch($object->newgroupid);
209 209
 
210
-						$oldinfo=$usergroup->_load_ldap_info();
211
-						$olddn=$usergroup->_load_ldap_dn($oldinfo);
210
+						$oldinfo = $usergroup->_load_ldap_info();
211
+						$olddn = $usergroup->_load_ldap_dn($oldinfo);
212 212
 
213 213
 						// Verify if entry exist
214
-						$container=$usergroup->_load_ldap_dn($oldinfo,1);
215
-						$search = "(".$usergroup->_load_ldap_dn($oldinfo,2).")";
216
-						$records=$ldap->search($container,$search);
214
+						$container = $usergroup->_load_ldap_dn($oldinfo, 1);
215
+						$search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")";
216
+						$records = $ldap->search($container, $search);
217 217
 						if (count($records) && $records['count'] == 0)
218 218
 						{
219 219
 							$olddn = '';
220 220
 						}
221 221
 
222
-						$info=$usergroup->_load_ldap_info();    // Contains all members, included the new one (insert already done before trigger call)
223
-						$dn=$usergroup->_load_ldap_dn($info);
222
+						$info = $usergroup->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call)
223
+						$dn = $usergroup->_load_ldap_dn($info);
224 224
 
225
-						$result=$ldap->update($dn,$info,$user,$olddn);
225
+						$result = $ldap->update($dn, $info, $user, $olddn);
226 226
 					}
227 227
 				}
228 228
 
229
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
229
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
230 230
 			}
231 231
 		}
232 232
 		elseif ($action == 'USER_REMOVEFROMGROUP')
233 233
 		{
234 234
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
235
-			if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
235
+			if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
236 236
 			{
237
-				$ldap=new Ldap();
238
-				$result=$ldap->connect_bind();
237
+				$ldap = new Ldap();
238
+				$result = $ldap->connect_bind();
239 239
 
240 240
 				if ($result > 0)
241 241
 				{
242 242
 					// Must edit $object->newgroupid
243
-					$usergroup=new UserGroup($this->db);
243
+					$usergroup = new UserGroup($this->db);
244 244
 					if ($object->oldgroupid > 0)
245 245
 					{
246 246
 						$usergroup->fetch($object->oldgroupid);
247 247
 
248
-						$oldinfo=$usergroup->_load_ldap_info();
249
-						$olddn=$usergroup->_load_ldap_dn($oldinfo);
248
+						$oldinfo = $usergroup->_load_ldap_info();
249
+						$olddn = $usergroup->_load_ldap_dn($oldinfo);
250 250
 
251 251
 						// Verify if entry exist
252
-						$container=$usergroup->_load_ldap_dn($oldinfo,1);
253
-						$search = "(".$usergroup->_load_ldap_dn($oldinfo,2).")";
254
-						$records=$ldap->search($container,$search);
252
+						$container = $usergroup->_load_ldap_dn($oldinfo, 1);
253
+						$search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")";
254
+						$records = $ldap->search($container, $search);
255 255
 						if (count($records) && $records['count'] == 0)
256 256
 						{
257 257
 							$olddn = '';
258 258
 						}
259 259
 
260
-						$info=$usergroup->_load_ldap_info();    // Contains all members, included the new one (insert already done before trigger call)
261
-						$dn=$usergroup->_load_ldap_dn($info);
260
+						$info = $usergroup->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call)
261
+						$dn = $usergroup->_load_ldap_dn($info);
262 262
 
263
-						$result=$ldap->update($dn,$info,$user,$olddn);
263
+						$result = $ldap->update($dn, $info, $user, $olddn);
264 264
 					}
265 265
 				}
266 266
 
267
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
267
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
268 268
 			}
269 269
 		}
270 270
 
@@ -272,81 +272,81 @@  discard block
 block discarded – undo
272 272
 		elseif ($action == 'GROUP_CREATE')
273 273
 		{
274 274
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
275
-			if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
275
+			if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
276 276
 			{
277
-				$ldap=new Ldap();
278
-				$result=$ldap->connect_bind();
277
+				$ldap = new Ldap();
278
+				$result = $ldap->connect_bind();
279 279
 
280 280
 				if ($result > 0)
281 281
 				{
282
-					$info=$object->_load_ldap_info();
283
-					$dn=$object->_load_ldap_dn($info);
282
+					$info = $object->_load_ldap_info();
283
+					$dn = $object->_load_ldap_dn($info);
284 284
 
285 285
 					// Get a gid number for objectclass PosixGroup
286
-					if (in_array('posixGroup',$info['objectclass'])) {
286
+					if (in_array('posixGroup', $info['objectclass'])) {
287 287
 						$info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS');
288 288
 					}
289 289
 
290
-					$result=$ldap->add($dn,$info,$user);
290
+					$result = $ldap->add($dn, $info, $user);
291 291
 				}
292 292
 
293
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
293
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
294 294
 			}
295 295
 		}
296 296
 		elseif ($action == 'GROUP_MODIFY')
297 297
 		{
298 298
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
299
-			if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
299
+			if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
300 300
 			{
301
-				$ldap=new Ldap();
302
-				$result=$ldap->connect_bind();
301
+				$ldap = new Ldap();
302
+				$result = $ldap->connect_bind();
303 303
 
304 304
 				if ($result > 0)
305 305
 				{
306
-					if (empty($object->oldcopy) || ! is_object($object->oldcopy))
306
+					if (empty($object->oldcopy) || !is_object($object->oldcopy))
307 307
 					{
308 308
 						dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
309 309
 						$object->oldcopy = clone $object;
310 310
 					}
311 311
 
312
-					$oldinfo=$object->oldcopy->_load_ldap_info();
313
-					$olddn=$object->oldcopy->_load_ldap_dn($oldinfo);
312
+					$oldinfo = $object->oldcopy->_load_ldap_info();
313
+					$olddn = $object->oldcopy->_load_ldap_dn($oldinfo);
314 314
 
315 315
 					// Verify if entry exist
316
-					$container=$object->oldcopy->_load_ldap_dn($oldinfo,1);
317
-					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")";
318
-					$records=$ldap->search($container,$search);
316
+					$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
317
+					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
318
+					$records = $ldap->search($container, $search);
319 319
 					if (count($records) && $records['count'] == 0)
320 320
 					{
321 321
 						$olddn = '';
322 322
 					}
323 323
 
324
-					$info=$object->_load_ldap_info();
325
-					$dn=$object->_load_ldap_dn($info);
324
+					$info = $object->_load_ldap_info();
325
+					$dn = $object->_load_ldap_dn($info);
326 326
 
327
-					$result=$ldap->update($dn,$info,$user,$olddn);
327
+					$result = $ldap->update($dn, $info, $user, $olddn);
328 328
 				}
329 329
 
330
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
330
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
331 331
 			}
332 332
 		}
333 333
 		elseif ($action == 'GROUP_DELETE')
334 334
 		{
335 335
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
336
-			if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
336
+			if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap')
337 337
 			{
338
-				$ldap=new Ldap();
339
-				$result=$ldap->connect_bind();
338
+				$ldap = new Ldap();
339
+				$result = $ldap->connect_bind();
340 340
 
341 341
 				if ($result > 0)
342 342
 				{
343
-					$info=$object->_load_ldap_info();
344
-					$dn=$object->_load_ldap_dn($info);
343
+					$info = $object->_load_ldap_info();
344
+					$dn = $object->_load_ldap_dn($info);
345 345
 
346
-					$result=$ldap->delete($dn);
346
+					$result = $ldap->delete($dn);
347 347
 				}
348 348
 
349
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
349
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
350 350
 			}
351 351
 		}
352 352
 
@@ -354,76 +354,76 @@  discard block
 block discarded – undo
354 354
 		elseif ($action == 'CONTACT_CREATE')
355 355
 		{
356 356
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
357
-			if (! empty($conf->global->LDAP_CONTACT_ACTIVE))
357
+			if (!empty($conf->global->LDAP_CONTACT_ACTIVE))
358 358
 			{
359
-				$ldap=new Ldap();
360
-				$result=$ldap->connect_bind();
359
+				$ldap = new Ldap();
360
+				$result = $ldap->connect_bind();
361 361
 
362 362
 				if ($result > 0)
363 363
 				{
364
-					$info=$object->_load_ldap_info();
365
-					$dn=$object->_load_ldap_dn($info);
364
+					$info = $object->_load_ldap_info();
365
+					$dn = $object->_load_ldap_dn($info);
366 366
 
367
-					$result=$ldap->add($dn,$info,$user);
367
+					$result = $ldap->add($dn, $info, $user);
368 368
 				}
369 369
 
370
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
370
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
371 371
 			}
372 372
 		}
373 373
 		elseif ($action == 'CONTACT_MODIFY')
374 374
 		{
375 375
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
376
-			if (! empty($conf->global->LDAP_CONTACT_ACTIVE))
376
+			if (!empty($conf->global->LDAP_CONTACT_ACTIVE))
377 377
 			{
378
-				$ldap=new Ldap();
379
-				$result=$ldap->connect_bind();
378
+				$ldap = new Ldap();
379
+				$result = $ldap->connect_bind();
380 380
 
381 381
 				if ($result > 0)
382 382
 				{
383
-					if (empty($object->oldcopy) || ! is_object($object->oldcopy))
383
+					if (empty($object->oldcopy) || !is_object($object->oldcopy))
384 384
 					{
385 385
 						dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
386 386
 						$object->oldcopy = clone $object;
387 387
 					}
388 388
 
389
-					$oldinfo=$object->oldcopy->_load_ldap_info();
390
-					$olddn=$object->oldcopy->_load_ldap_dn($oldinfo);
389
+					$oldinfo = $object->oldcopy->_load_ldap_info();
390
+					$olddn = $object->oldcopy->_load_ldap_dn($oldinfo);
391 391
 
392 392
 					// Verify if entry exist
393
-					$container=$object->oldcopy->_load_ldap_dn($oldinfo,1);
394
-					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")";
395
-					$records=$ldap->search($container,$search);
393
+					$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
394
+					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
395
+					$records = $ldap->search($container, $search);
396 396
 					if (count($records) && $records['count'] == 0)
397 397
 					{
398 398
 						$olddn = '';
399 399
 					}
400 400
 
401
-					$info=$object->_load_ldap_info();
402
-					$dn=$object->_load_ldap_dn($info);
401
+					$info = $object->_load_ldap_info();
402
+					$dn = $object->_load_ldap_dn($info);
403 403
 
404
-					$result=$ldap->update($dn,$info,$user,$olddn);
404
+					$result = $ldap->update($dn, $info, $user, $olddn);
405 405
 				}
406 406
 
407
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
407
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
408 408
 			}
409 409
 		}
410 410
 		elseif ($action == 'CONTACT_DELETE')
411 411
 		{
412 412
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
413
-			if (! empty($conf->global->LDAP_CONTACT_ACTIVE))
413
+			if (!empty($conf->global->LDAP_CONTACT_ACTIVE))
414 414
 			{
415
-				$ldap=new Ldap();
416
-				$result=$ldap->connect_bind();
415
+				$ldap = new Ldap();
416
+				$result = $ldap->connect_bind();
417 417
 
418 418
 				if ($result > 0)
419 419
 				{
420
-					$info=$object->_load_ldap_info();
421
-					$dn=$object->_load_ldap_dn($info);
420
+					$info = $object->_load_ldap_info();
421
+					$dn = $object->_load_ldap_dn($info);
422 422
 
423
-					$result=$ldap->delete($dn);
423
+					$result = $ldap->delete($dn);
424 424
 				}
425 425
 
426
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
426
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
427 427
 			}
428 428
 		}
429 429
 
@@ -431,78 +431,78 @@  discard block
 block discarded – undo
431 431
 		elseif ($action == 'MEMBER_CREATE')
432 432
 		{
433 433
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
434
-			if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
434
+			if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
435 435
 			{
436
-				$ldap=new Ldap();
437
-				$result=$ldap->connect_bind();
436
+				$ldap = new Ldap();
437
+				$result = $ldap->connect_bind();
438 438
 
439 439
 				if ($result > 0)
440 440
 				{
441
-					$info=$object->_load_ldap_info();
442
-					$dn=$object->_load_ldap_dn($info);
441
+					$info = $object->_load_ldap_info();
442
+					$dn = $object->_load_ldap_dn($info);
443 443
 
444
-					$result=$ldap->add($dn,$info,$user);
444
+					$result = $ldap->add($dn, $info, $user);
445 445
 
446 446
 					// For member type
447
-					if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
447
+					if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
448 448
 					{
449
-						$membertype=new AdherentType($this->db);
449
+						$membertype = new AdherentType($this->db);
450 450
 						if ($object->typeid > 0)
451 451
 						{
452 452
 							$membertype->fetch($object->typeid);
453 453
 							$membertype->listMembersForMemberType('', 1);
454 454
 
455
-							$oldinfo=$membertype->_load_ldap_info();
456
-							$olddn=$membertype->_load_ldap_dn($oldinfo);
455
+							$oldinfo = $membertype->_load_ldap_info();
456
+							$olddn = $membertype->_load_ldap_dn($oldinfo);
457 457
 
458 458
 							// Verify if entry exist
459
-							$container=$membertype->_load_ldap_dn($oldinfo,1);
460
-							$search = "(".$membertype->_load_ldap_dn($oldinfo,2).")";
461
-							$records=$ldap->search($container,$search);
459
+							$container = $membertype->_load_ldap_dn($oldinfo, 1);
460
+							$search = "(".$membertype->_load_ldap_dn($oldinfo, 2).")";
461
+							$records = $ldap->search($container, $search);
462 462
 							if (count($records) && $records['count'] == 0)
463 463
 							{
464 464
 								$olddn = '';
465 465
 							}
466 466
 
467
-							$info=$membertype->_load_ldap_info();    // Contains all members, included the new one (insert already done before trigger call)
468
-							$dn=$membertype->_load_ldap_dn($info);
467
+							$info = $membertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call)
468
+							$dn = $membertype->_load_ldap_dn($info);
469 469
 
470
-							$result=$ldap->update($dn,$info,$user,$olddn);
470
+							$result = $ldap->update($dn, $info, $user, $olddn);
471 471
 						}
472 472
 					}
473 473
 				}
474 474
 
475
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
475
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
476 476
 			}
477 477
 		}
478 478
 		elseif ($action == 'MEMBER_VALIDATE')
479 479
 		{
480 480
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
481
-			if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
481
+			if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
482 482
 			{
483 483
 				// If status field is setup to be synchronized
484
-				if (! empty($conf->global->LDAP_FIELD_MEMBER_STATUS))
484
+				if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS))
485 485
 				{
486
-					$ldap=new Ldap();
487
-					$result=$ldap->connect_bind();
486
+					$ldap = new Ldap();
487
+					$result = $ldap->connect_bind();
488 488
 
489 489
 					if ($result > 0)
490 490
 					{
491
-						$info=$object->_load_ldap_info();
492
-						$dn=$object->_load_ldap_dn($info);
493
-						$olddn=$dn;	// We know olddn=dn as we change only status
491
+						$info = $object->_load_ldap_info();
492
+						$dn = $object->_load_ldap_dn($info);
493
+						$olddn = $dn; // We know olddn=dn as we change only status
494 494
 
495
-						$result=$ldap->update($dn,$info,$user,$olddn);
495
+						$result = $ldap->update($dn, $info, $user, $olddn);
496 496
 					}
497 497
 
498
-					if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
498
+					if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
499 499
 				}
500 500
 			}
501 501
 		}
502 502
 		elseif ($action == 'MEMBER_SUBSCRIPTION')
503 503
 		{
504 504
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
505
-			if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
505
+			if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
506 506
 			{
507 507
 				// If subscriptions fields are setup to be synchronized
508 508
 				if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE
@@ -511,212 +511,212 @@  discard block
 block discarded – undo
511 511
 					|| $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT
512 512
 					|| $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)
513 513
 				{
514
-					$ldap=new Ldap();
515
-					$result=$ldap->connect_bind();
514
+					$ldap = new Ldap();
515
+					$result = $ldap->connect_bind();
516 516
 
517 517
 					if ($result > 0)
518 518
 					{
519
-						$info=$object->_load_ldap_info();
520
-						$dn=$object->_load_ldap_dn($info);
521
-						$olddn=$dn;	// We know olddn=dn as we change only subscriptions
519
+						$info = $object->_load_ldap_info();
520
+						$dn = $object->_load_ldap_dn($info);
521
+						$olddn = $dn; // We know olddn=dn as we change only subscriptions
522 522
 
523
-						$result=$ldap->update($dn,$info,$user,$olddn);
523
+						$result = $ldap->update($dn, $info, $user, $olddn);
524 524
 					}
525 525
 
526
-					if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
526
+					if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
527 527
 				}
528 528
 			}
529 529
 		}
530 530
 		elseif ($action == 'MEMBER_MODIFY')
531 531
 		{
532 532
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
533
-			if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
533
+			if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
534 534
 			{
535
-				$ldap=new Ldap();
536
-				$result=$ldap->connect_bind();
535
+				$ldap = new Ldap();
536
+				$result = $ldap->connect_bind();
537 537
 
538 538
 				if ($result > 0)
539 539
 				{
540
-					if (empty($object->oldcopy) || ! is_object($object->oldcopy))
540
+					if (empty($object->oldcopy) || !is_object($object->oldcopy))
541 541
 					{
542 542
 						dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
543 543
 						$object->oldcopy = clone $object;
544 544
 					}
545 545
 
546
-					$oldinfo=$object->oldcopy->_load_ldap_info();
547
-					$olddn=$object->oldcopy->_load_ldap_dn($oldinfo);
546
+					$oldinfo = $object->oldcopy->_load_ldap_info();
547
+					$olddn = $object->oldcopy->_load_ldap_dn($oldinfo);
548 548
 
549 549
 					// Verify if entry exist
550
-					$container=$object->oldcopy->_load_ldap_dn($oldinfo,1);
551
-					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")";
552
-					$records=$ldap->search($container,$search);
550
+					$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
551
+					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
552
+					$records = $ldap->search($container, $search);
553 553
 					if (count($records) && $records['count'] == 0)
554 554
 					{
555 555
 						$olddn = '';
556 556
 					}
557 557
 
558
-					$info=$object->_load_ldap_info();
559
-					$dn=$object->_load_ldap_dn($info);
560
-					$newrdn=$object->_load_ldap_dn($info,2);
561
-					$newparent=$object->_load_ldap_dn($info,1);
558
+					$info = $object->_load_ldap_info();
559
+					$dn = $object->_load_ldap_dn($info);
560
+					$newrdn = $object->_load_ldap_dn($info, 2);
561
+					$newparent = $object->_load_ldap_dn($info, 1);
562 562
 
563
-					$result=$ldap->update($dn,$info,$user,$olddn,$newrdn,$newparent);
563
+					$result = $ldap->update($dn, $info, $user, $olddn, $newrdn, $newparent);
564 564
 
565 565
 					// For member type
566
-					if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
566
+					if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
567 567
 					{
568 568
 						/*
569 569
 						 * Change member info
570 570
 						 */
571
-						$newmembertype=new AdherentType($this->db);
571
+						$newmembertype = new AdherentType($this->db);
572 572
 						$newmembertype->fetch($object->typeid);
573 573
 						$newmembertype->listMembersForMemberType('', 1);
574 574
 
575
-						$oldinfo=$newmembertype->_load_ldap_info();
576
-						$olddn=$newmembertype->_load_ldap_dn($oldinfo);
575
+						$oldinfo = $newmembertype->_load_ldap_info();
576
+						$olddn = $newmembertype->_load_ldap_dn($oldinfo);
577 577
 
578 578
 						// Verify if entry exist
579
-						$container=$newmembertype->_load_ldap_dn($oldinfo,1);
580
-						$search = "(".$newmembertype->_load_ldap_dn($oldinfo,2).")";
581
-						$records=$ldap->search($container,$search);
579
+						$container = $newmembertype->_load_ldap_dn($oldinfo, 1);
580
+						$search = "(".$newmembertype->_load_ldap_dn($oldinfo, 2).")";
581
+						$records = $ldap->search($container, $search);
582 582
 						if (count($records) && $records['count'] == 0)
583 583
 						{
584 584
 							$olddn = '';
585 585
 						}
586 586
 
587
-						$info=$newmembertype->_load_ldap_info();    // Contains all members, included the new one (insert already done before trigger call)
588
-						$dn=$newmembertype->_load_ldap_dn($info);
587
+						$info = $newmembertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call)
588
+						$dn = $newmembertype->_load_ldap_dn($info);
589 589
 
590
-						$result=$ldap->update($dn,$info,$user,$olddn);
590
+						$result = $ldap->update($dn, $info, $user, $olddn);
591 591
 
592 592
 						if ($object->oldcopy->typeid != $object->typeid)
593 593
 						{
594 594
 							/*
595 595
 							 * Remove member in old member type
596 596
 							 */
597
-							$oldmembertype=new AdherentType($this->db);
597
+							$oldmembertype = new AdherentType($this->db);
598 598
 							$oldmembertype->fetch($object->oldcopy->typeid);
599 599
 							$oldmembertype->listMembersForMemberType('', 1);
600 600
 
601
-							$oldinfo=$oldmembertype->_load_ldap_info();
602
-							$olddn=$oldmembertype->_load_ldap_dn($oldinfo);
601
+							$oldinfo = $oldmembertype->_load_ldap_info();
602
+							$olddn = $oldmembertype->_load_ldap_dn($oldinfo);
603 603
 
604 604
 							// Verify if entry exist
605
-							$container=$oldmembertype->_load_ldap_dn($oldinfo,1);
606
-							$search = "(".$oldmembertype->_load_ldap_dn($oldinfo,2).")";
607
-							$records=$ldap->search($container,$search);
605
+							$container = $oldmembertype->_load_ldap_dn($oldinfo, 1);
606
+							$search = "(".$oldmembertype->_load_ldap_dn($oldinfo, 2).")";
607
+							$records = $ldap->search($container, $search);
608 608
 							if (count($records) && $records['count'] == 0)
609 609
 							{
610 610
 								$olddn = '';
611 611
 							}
612 612
 
613
-							$info=$oldmembertype->_load_ldap_info();    // Contains all members, included the new one (insert already done before trigger call)
614
-							$dn=$oldmembertype->_load_ldap_dn($info);
613
+							$info = $oldmembertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call)
614
+							$dn = $oldmembertype->_load_ldap_dn($info);
615 615
 
616
-							$result=$ldap->update($dn,$info,$user,$olddn);
616
+							$result = $ldap->update($dn, $info, $user, $olddn);
617 617
 						}
618 618
 					}
619 619
 				}
620 620
 
621
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
621
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
622 622
 			}
623 623
 		}
624 624
 		elseif ($action == 'MEMBER_NEW_PASSWORD')
625 625
 		{
626 626
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
627
-			if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
627
+			if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
628 628
 			{
629 629
 				// If password field is setup to be synchronized
630 630
 				if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED)
631 631
 				{
632
-					$ldap=new Ldap();
633
-					$result=$ldap->connect_bind();
632
+					$ldap = new Ldap();
633
+					$result = $ldap->connect_bind();
634 634
 
635 635
 					if ($result > 0)
636 636
 					{
637
-						$info=$object->_load_ldap_info();
638
-						$dn=$object->_load_ldap_dn($info);
639
-						$olddn=$dn;	// We know olddn=dn as we change only password
637
+						$info = $object->_load_ldap_info();
638
+						$dn = $object->_load_ldap_dn($info);
639
+						$olddn = $dn; // We know olddn=dn as we change only password
640 640
 
641
-						$result=$ldap->update($dn,$info,$user,$olddn);
641
+						$result = $ldap->update($dn, $info, $user, $olddn);
642 642
 					}
643 643
 
644
-					if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
644
+					if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
645 645
 				}
646 646
 			}
647 647
 		}
648 648
 		elseif ($action == 'MEMBER_RESILIATE')
649 649
 		{
650 650
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
651
-			if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
651
+			if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
652 652
 			{
653 653
 				// If status field is setup to be synchronized
654
-				if (! empty($conf->global->LDAP_FIELD_MEMBER_STATUS))
654
+				if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS))
655 655
 				{
656
-					$ldap=new Ldap();
657
-					$result=$ldap->connect_bind();
656
+					$ldap = new Ldap();
657
+					$result = $ldap->connect_bind();
658 658
 
659 659
 					if ($result > 0)
660 660
 					{
661
-						$info=$object->_load_ldap_info();
662
-						$dn=$object->_load_ldap_dn($info);
663
-						$olddn=$dn;	// We know olddn=dn as we change only status
661
+						$info = $object->_load_ldap_info();
662
+						$dn = $object->_load_ldap_dn($info);
663
+						$olddn = $dn; // We know olddn=dn as we change only status
664 664
 
665
-						$result=$ldap->update($dn,$info,$user,$olddn);
665
+						$result = $ldap->update($dn, $info, $user, $olddn);
666 666
 					}
667 667
 
668
-					if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
668
+					if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
669 669
 				}
670 670
 			}
671 671
 		}
672 672
 		elseif ($action == 'MEMBER_DELETE')
673 673
 		{
674 674
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
675
-			if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
675
+			if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1')
676 676
 			{
677
-				$ldap=new Ldap();
678
-				$result=$ldap->connect_bind();
677
+				$ldap = new Ldap();
678
+				$result = $ldap->connect_bind();
679 679
 
680 680
 				if ($result > 0)
681 681
 				{
682
-					$info=$object->_load_ldap_info();
683
-					$dn=$object->_load_ldap_dn($info);
682
+					$info = $object->_load_ldap_info();
683
+					$dn = $object->_load_ldap_dn($info);
684 684
 
685
-					$result=$ldap->delete($dn);
685
+					$result = $ldap->delete($dn);
686 686
 
687 687
 					// For member type
688
-					if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
688
+					if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
689 689
 					{
690 690
 						if ($object->typeid > 0)
691 691
 						{
692 692
 							/*
693 693
 							 * Remove member in member type
694 694
 							 */
695
-							$membertype=new AdherentType($this->db);
695
+							$membertype = new AdherentType($this->db);
696 696
 							$membertype->fetch($object->typeid);
697
-							$membertype->listMembersForMemberType('a.rowid != ' . $object->id, 1); // remove deleted member from the list
697
+							$membertype->listMembersForMemberType('a.rowid != '.$object->id, 1); // remove deleted member from the list
698 698
 
699
-							$oldinfo=$membertype->_load_ldap_info();
700
-							$olddn=$membertype->_load_ldap_dn($oldinfo);
699
+							$oldinfo = $membertype->_load_ldap_info();
700
+							$olddn = $membertype->_load_ldap_dn($oldinfo);
701 701
 
702 702
 							// Verify if entry exist
703
-							$container=$membertype->_load_ldap_dn($oldinfo,1);
704
-							$search = "(".$membertype->_load_ldap_dn($oldinfo,2).")";
705
-							$records=$ldap->search($container,$search);
703
+							$container = $membertype->_load_ldap_dn($oldinfo, 1);
704
+							$search = "(".$membertype->_load_ldap_dn($oldinfo, 2).")";
705
+							$records = $ldap->search($container, $search);
706 706
 							if (count($records) && $records['count'] == 0)
707 707
 							{
708 708
 								$olddn = '';
709 709
 							}
710 710
 
711
-							$info=$membertype->_load_ldap_info();    // Contains all members, included the new one (insert already done before trigger call)
712
-							$dn=$membertype->_load_ldap_dn($info);
711
+							$info = $membertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call)
712
+							$dn = $membertype->_load_ldap_dn($info);
713 713
 
714
-							$result=$ldap->update($dn,$info,$user,$olddn);
714
+							$result = $ldap->update($dn, $info, $user, $olddn);
715 715
 						}
716 716
 					}
717 717
 				}
718 718
 
719
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
719
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
720 720
 			}
721 721
 		}
722 722
 
@@ -724,38 +724,38 @@  discard block
 block discarded – undo
724 724
 		elseif ($action == 'MEMBER_TYPE_CREATE')
725 725
 		{
726 726
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
727
-			if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
727
+			if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
728 728
 			{
729
-				$ldap=new Ldap();
730
-				$result=$ldap->connect_bind();
729
+				$ldap = new Ldap();
730
+				$result = $ldap->connect_bind();
731 731
 
732 732
 				if ($result > 0)
733 733
 				{
734
-					$info=$object->_load_ldap_info();
735
-					$dn=$object->_load_ldap_dn($info);
734
+					$info = $object->_load_ldap_info();
735
+					$dn = $object->_load_ldap_dn($info);
736 736
 
737 737
 					// Get a gid number for objectclass PosixGroup
738
-					if (in_array('posixGroup',$info['objectclass'])) {
738
+					if (in_array('posixGroup', $info['objectclass'])) {
739 739
 						$info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_MEMBERS_TYPE');
740 740
 					}
741 741
 
742
-					$result=$ldap->add($dn,$info,$user);
742
+					$result = $ldap->add($dn, $info, $user);
743 743
 				}
744 744
 
745
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
745
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
746 746
 			}
747 747
 		}
748 748
 		elseif ($action == 'MEMBER_TYPE_MODIFY')
749 749
 		{
750 750
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
751
-			if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
751
+			if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
752 752
 			{
753
-				$ldap=new Ldap();
754
-				$result=$ldap->connect_bind();
753
+				$ldap = new Ldap();
754
+				$result = $ldap->connect_bind();
755 755
 
756 756
 				if ($result > 0)
757 757
 				{
758
-					if (empty($object->oldcopy) || ! is_object($object->oldcopy))
758
+					if (empty($object->oldcopy) || !is_object($object->oldcopy))
759 759
 					{
760 760
 						dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
761 761
 						$object->oldcopy = clone $object;
@@ -763,13 +763,13 @@  discard block
 block discarded – undo
763 763
 
764 764
 					$object->oldcopy->listMembersForMemberType('', 1);
765 765
 
766
-					$oldinfo=$object->oldcopy->_load_ldap_info();
767
-					$olddn=$object->oldcopy->_load_ldap_dn($oldinfo);
766
+					$oldinfo = $object->oldcopy->_load_ldap_info();
767
+					$olddn = $object->oldcopy->_load_ldap_dn($oldinfo);
768 768
 
769 769
 					// Verify if entry exist
770
-					$container=$object->oldcopy->_load_ldap_dn($oldinfo,1);
771
-					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")";
772
-					$records=$ldap->search($container,$search);
770
+					$container = $object->oldcopy->_load_ldap_dn($oldinfo, 1);
771
+					$search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")";
772
+					$records = $ldap->search($container, $search);
773 773
 					if (count($records) && $records['count'] == 0)
774 774
 					{
775 775
 						$olddn = '';
@@ -777,32 +777,32 @@  discard block
 block discarded – undo
777 777
 
778 778
 					$object->listMembersForMemberType('', 1);
779 779
 
780
-					$info=$object->_load_ldap_info();
781
-					$dn=$object->_load_ldap_dn($info);
780
+					$info = $object->_load_ldap_info();
781
+					$dn = $object->_load_ldap_dn($info);
782 782
 
783
-					$result=$ldap->update($dn,$info,$user,$olddn);
783
+					$result = $ldap->update($dn, $info, $user, $olddn);
784 784
 				}
785 785
 
786
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
786
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
787 787
 			}
788 788
 		}
789 789
 		elseif ($action == 'MEMBER_TYPE_DELETE')
790 790
 		{
791 791
 			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
792
-			if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
792
+			if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1')
793 793
 			{
794
-				$ldap=new Ldap();
795
-				$result=$ldap->connect_bind();
794
+				$ldap = new Ldap();
795
+				$result = $ldap->connect_bind();
796 796
 
797 797
 				if ($result > 0)
798 798
 				{
799
-					$info=$object->_load_ldap_info();
800
-					$dn=$object->_load_ldap_dn($info);
799
+					$info = $object->_load_ldap_info();
800
+					$dn = $object->_load_ldap_dn($info);
801 801
 
802
-					$result=$ldap->delete($dn);
802
+					$result = $ldap->delete($dn);
803 803
 				}
804 804
 
805
-				if ($result < 0) $this->error="ErrorLDAP ".$ldap->error;
805
+				if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error;
806 806
 			}
807 807
 		}
808 808
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php 1 patch
Spacing   +299 added lines, -299 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
73 73
 	{
74
-        if (empty($conf->agenda->enabled)) return 0;     // Module not active, we do nothing
74
+        if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
75 75
 
76 76
 		$key = 'MAIN_AGENDA_ACTIONAUTO_'.$action;
77 77
 
@@ -82,25 +82,25 @@  discard block
 block discarded – undo
82 82
 
83 83
 		$langs->load("agenda");
84 84
 
85
-		if (empty($object->actiontypecode)) $object->actiontypecode='AC_OTH_AUTO';
85
+		if (empty($object->actiontypecode)) $object->actiontypecode = 'AC_OTH_AUTO';
86 86
 
87 87
 		// Actions
88 88
 		if ($action == 'COMPANY_CREATE')
89 89
         {
90 90
             // Load translation files required by the page
91
-            $langs->loadLangs(array("agenda","other","companies"));
91
+            $langs->loadLangs(array("agenda", "other", "companies"));
92 92
 
93
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->name);
94
-            $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->name);
95
-            if (! empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")";
93
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("NewCompanyToDolibarr", $object->name);
94
+            $object->actionmsg = $langs->transnoentities("NewCompanyToDolibarr", $object->name);
95
+            if (!empty($object->prefix)) $object->actionmsg .= " (".$object->prefix.")";
96 96
 
97
-			$object->sendtoid=0;
98
-			$object->socid=$object->id;
97
+			$object->sendtoid = 0;
98
+			$object->socid = $object->id;
99 99
         }
100 100
         elseif ($action == 'COMPANY_SENTBYMAIL')
101 101
         {
102 102
             // Load translation files required by the page
103
-            $langs->loadLangs(array("agenda","other","orders"));
103
+            $langs->loadLangs(array("agenda", "other", "orders"));
104 104
 
105 105
             if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR);
106 106
 
@@ -110,22 +110,22 @@  discard block
 block discarded – undo
110 110
         elseif ($action == 'CONTRACT_VALIDATE')
111 111
         {
112 112
             // Load translation files required by the page
113
-            $langs->loadLangs(array("agenda","other","contracts"));
113
+            $langs->loadLangs(array("agenda", "other", "contracts"));
114 114
 
115
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
116
-            $object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
115
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
116
+            $object->actionmsg = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
117 117
 
118
-            $object->sendtoid=0;
118
+            $object->sendtoid = 0;
119 119
 		}
120 120
 		elseif ($action == 'CONTRACT_SENTBYMAIL')
121 121
 		{
122 122
 			// Load translation files required by the page
123
-            $langs->loadLangs(array("agenda","other","contracts"));
123
+            $langs->loadLangs(array("agenda", "other", "contracts"));
124 124
 
125
-			if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractSentByEMail",$object->ref);
125
+			if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ContractSentByEMail", $object->ref);
126 126
 			if (empty($object->actionmsg))
127 127
 			{
128
-				$object->actionmsg=$langs->transnoentities("ContractSentByEMail",$object->ref);
128
+				$object->actionmsg = $langs->transnoentities("ContractSentByEMail", $object->ref);
129 129
 			}
130 130
 
131 131
 			// Parameters $object->sendtoid defined by caller
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
 		elseif ($action == 'PROPAL_VALIDATE')
135 135
         {
136 136
             // Load translation files required by the page
137
-            $langs->loadLangs(array("agenda","other","propal"));
137
+            $langs->loadLangs(array("agenda", "other", "propal"));
138 138
 
139
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
140
-            $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
139
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
140
+            $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
141 141
 
142
-			$object->sendtoid=0;
142
+			$object->sendtoid = 0;
143 143
 		}
144 144
         elseif ($action == 'PROPAL_SENTBYMAIL')
145 145
         {
146 146
             // Load translation files required by the page
147
-            $langs->loadLangs(array("agenda","other","propal"));
147
+            $langs->loadLangs(array("agenda", "other", "propal"));
148 148
 
149
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref);
149
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref);
150 150
             if (empty($object->actionmsg))
151 151
             {
152
-                $object->actionmsg=$langs->transnoentities("ProposalSentByEMail",$object->ref);
152
+                $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref);
153 153
             }
154 154
 
155 155
             // Parameters $object->sendtoid defined by caller
@@ -158,82 +158,82 @@  discard block
 block discarded – undo
158 158
 		elseif ($action == 'PROPAL_CLOSE_SIGNED')
159 159
         {
160 160
             // Load translation files required by the page
161
-            $langs->loadLangs(array("agenda","other","propal"));
161
+            $langs->loadLangs(array("agenda", "other", "propal"));
162 162
 
163
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
164
-            $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
163
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
164
+            $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
165 165
 
166
-			$object->sendtoid=0;
166
+			$object->sendtoid = 0;
167 167
 		}
168 168
 		elseif ($action == 'PROPAL_CLASSIFY_BILLED')
169 169
         {
170 170
             // Load translation files required by the page
171
-            $langs->loadLangs(array("agenda","other","propal"));
171
+            $langs->loadLangs(array("agenda", "other", "propal"));
172 172
 
173
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref);
174
-            $object->actionmsg=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref);
173
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
174
+            $object->actionmsg = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
175 175
 
176
-			$object->sendtoid=0;
176
+			$object->sendtoid = 0;
177 177
 		}
178 178
 		elseif ($action == 'PROPAL_CLOSE_REFUSED')
179 179
         {
180 180
             // Load translation files required by the page
181
-            $langs->loadLangs(array("agenda","other","propal"));
181
+            $langs->loadLangs(array("agenda", "other", "propal"));
182 182
 
183
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
184
-            $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
183
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
184
+            $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
185 185
 
186
-			$object->sendtoid=0;
186
+			$object->sendtoid = 0;
187 187
 		}
188 188
 		elseif ($action == 'ORDER_VALIDATE')
189 189
         {
190 190
             // Load translation files required by the page
191
-            $langs->loadLangs(array("agenda","orders"));
191
+            $langs->loadLangs(array("agenda", "orders"));
192 192
 
193
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
194
-            $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
193
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
194
+            $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
195 195
 
196
-			$object->sendtoid=0;
196
+			$object->sendtoid = 0;
197 197
 		}
198 198
 		elseif ($action == 'ORDER_CLOSE')
199 199
         {
200 200
             // Load translation files required by the page
201
-            $langs->loadLangs(array("agenda","other","orders"));
201
+            $langs->loadLangs(array("agenda", "other", "orders"));
202 202
 
203
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderDeliveredInDolibarr",$object->ref);
204
-            $object->actionmsg=$langs->transnoentities("OrderDeliveredInDolibarr",$object->ref);
203
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
204
+            $object->actionmsg = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
205 205
 
206
-			$object->sendtoid=0;
206
+			$object->sendtoid = 0;
207 207
 		}
208 208
 		elseif ($action == 'ORDER_CLASSIFY_BILLED')
209 209
         {
210 210
             // Load translation files required by the page
211
-            $langs->loadLangs(array("agenda","other","orders"));
211
+            $langs->loadLangs(array("agenda", "other", "orders"));
212 212
 
213
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderBilledInDolibarr",$object->ref);
214
-            $object->actionmsg=$langs->transnoentities("OrderBilledInDolibarr",$object->ref);
213
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderBilledInDolibarr", $object->ref);
214
+            $object->actionmsg = $langs->transnoentities("OrderBilledInDolibarr", $object->ref);
215 215
 
216
-			$object->sendtoid=0;
216
+			$object->sendtoid = 0;
217 217
 		}
218 218
 		elseif ($action == 'ORDER_CANCEL')
219 219
         {
220 220
             // Load translation files required by the page
221
-            $langs->loadLangs(array("agenda","other","orders"));
221
+            $langs->loadLangs(array("agenda", "other", "orders"));
222 222
 
223
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCanceledInDolibarr",$object->ref);
224
-            $object->actionmsg=$langs->transnoentities("OrderCanceledInDolibarr",$object->ref);
223
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
224
+            $object->actionmsg = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
225 225
 
226
-			$object->sendtoid=0;
226
+			$object->sendtoid = 0;
227 227
 		}
228 228
 		elseif ($action == 'ORDER_SENTBYMAIL')
229 229
         {
230 230
             // Load translation files required by the page
231
-            $langs->loadLangs(array("agenda","other","orders"));
231
+            $langs->loadLangs(array("agenda", "other", "orders"));
232 232
 
233
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref);
233
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderSentByEMail", $object->ref);
234 234
             if (empty($object->actionmsg))
235 235
             {
236
-                $object->actionmsg=$langs->transnoentities("OrderSentByEMail",$object->ref);
236
+                $object->actionmsg = $langs->transnoentities("OrderSentByEMail", $object->ref);
237 237
             }
238 238
 
239 239
             // Parameters $object->sendtoid defined by caller
@@ -242,32 +242,32 @@  discard block
 block discarded – undo
242 242
 		elseif ($action == 'BILL_VALIDATE')
243 243
         {
244 244
             // Load translation files required by the page
245
-            $langs->loadLangs(array("agenda","other","bills"));
245
+            $langs->loadLangs(array("agenda", "other", "bills"));
246 246
 
247
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
248
-            $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
247
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
248
+            $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
249 249
 
250
-			$object->sendtoid=0;
250
+			$object->sendtoid = 0;
251 251
 		}
252 252
 		elseif ($action == 'BILL_UNVALIDATE')
253 253
         {
254 254
            // Load translation files required by the page
255
-            $langs->loadLangs(array("agenda","other","bills"));
255
+            $langs->loadLangs(array("agenda", "other", "bills"));
256 256
 
257
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref);
258
-            $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref);
257
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
258
+            $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
259 259
 
260
-			$object->sendtoid=0;
260
+			$object->sendtoid = 0;
261 261
 		}
262 262
         elseif ($action == 'BILL_SENTBYMAIL')
263 263
         {
264 264
             // Load translation files required by the page
265
-            $langs->loadLangs(array("agenda","other","bills"));
265
+            $langs->loadLangs(array("agenda", "other", "bills"));
266 266
 
267
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref);
267
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceSentByEMail", $object->ref);
268 268
             if (empty($object->actionmsg))
269 269
             {
270
-                $object->actionmsg=$langs->transnoentities("InvoiceSentByEMail",$object->ref);
270
+                $object->actionmsg = $langs->transnoentities("InvoiceSentByEMail", $object->ref);
271 271
             }
272 272
 
273 273
             // Parameters $object->sendtoid defined by caller
@@ -276,69 +276,69 @@  discard block
 block discarded – undo
276 276
 		elseif ($action == 'BILL_PAYED')
277 277
         {
278 278
             // Load translation files required by the page
279
-            $langs->loadLangs(array("agenda","other","bills"));
279
+            $langs->loadLangs(array("agenda", "other", "bills"));
280 280
 
281 281
             // Values for this action can't be defined by caller.
282
-            $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
283
-            $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
282
+            $object->actionmsg2 = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
283
+            $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
284 284
 
285
-            $object->sendtoid=0;
285
+            $object->sendtoid = 0;
286 286
 		}
287 287
 		elseif ($action == 'BILL_CANCEL')
288 288
         {
289 289
             // Load translation files required by the page
290
-            $langs->loadLangs(array("agenda","other","bills"));
290
+            $langs->loadLangs(array("agenda", "other", "bills"));
291 291
 
292
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
293
-            $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
292
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
293
+            $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
294 294
 
295
-            $object->sendtoid=0;
295
+            $object->sendtoid = 0;
296 296
 		}
297 297
 		elseif ($action == 'FICHINTER_CREATE')
298 298
         {
299 299
             // Load translation files required by the page
300
-            $langs->loadLangs(array("agenda","other","interventions"));
300
+            $langs->loadLangs(array("agenda", "other", "interventions"));
301 301
 
302
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionCreatedInDolibarr",$object->ref);
303
-            $object->actionmsg=$langs->transnoentities("InterventionCreatedInDolibarr",$object->ref);
302
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
303
+            $object->actionmsg = $langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
304 304
 
305
-            $object->sendtoid=0;
306
-			$object->fk_element=0;
307
-			$object->elementtype='';
305
+            $object->sendtoid = 0;
306
+			$object->fk_element = 0;
307
+			$object->elementtype = '';
308 308
 		}
309 309
 		elseif ($action == 'FICHINTER_VALIDATE')
310 310
         {
311 311
             // Load translation files required by the page
312
-            $langs->loadLangs(array("agenda","other","interventions"));
312
+            $langs->loadLangs(array("agenda", "other", "interventions"));
313 313
 
314
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
315
-            $object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
314
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
315
+            $object->actionmsg = $langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
316 316
 
317
-            $object->sendtoid=0;
318
-			$object->fk_element=0;
319
-			$object->elementtype='';
317
+            $object->sendtoid = 0;
318
+			$object->fk_element = 0;
319
+			$object->elementtype = '';
320 320
 		}
321 321
 		elseif ($action == 'FICHINTER_MODIFY')
322 322
         {
323 323
             // Load translation files required by the page
324
-            $langs->loadLangs(array("agenda","other","interventions"));
324
+            $langs->loadLangs(array("agenda", "other", "interventions"));
325 325
 
326
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionModifiedInDolibarr",$object->ref);
327
-            $object->actionmsg=$langs->transnoentities("InterventionModifiedInDolibarr",$object->ref);
326
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
327
+            $object->actionmsg = $langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
328 328
 
329
-            $object->sendtoid=0;
330
-			$object->fk_element=0;
331
-			$object->elementtype='';
329
+            $object->sendtoid = 0;
330
+			$object->fk_element = 0;
331
+			$object->elementtype = '';
332 332
 		}
333 333
 		elseif ($action == 'FICHINTER_SENTBYMAIL')
334 334
         {
335 335
             // Load translation files required by the page
336
-            $langs->loadLangs(array("agenda","other","interventions"));
336
+            $langs->loadLangs(array("agenda", "other", "interventions"));
337 337
 
338
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref);
338
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionSentByEMail", $object->ref);
339 339
             if (empty($object->actionmsg))
340 340
             {
341
-            	$object->actionmsg=$langs->transnoentities("InterventionSentByEMail",$object->ref);
341
+            	$object->actionmsg = $langs->transnoentities("InterventionSentByEMail", $object->ref);
342 342
             }
343 343
 
344 344
             // Parameters $object->sendtoid defined by caller
@@ -347,44 +347,44 @@  discard block
 block discarded – undo
347 347
         elseif ($action == 'FICHINTER_CLASSIFY_BILLED')
348 348
         {
349 349
             // Load translation files required by the page
350
-            $langs->loadLangs(array("agenda","other","interventions"));
350
+            $langs->loadLangs(array("agenda", "other", "interventions"));
351 351
 
352
-           	if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref);
353
-           	$object->actionmsg=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref);
352
+           	if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
353
+           	$object->actionmsg = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
354 354
 
355
-            $object->sendtoid=0;
355
+            $object->sendtoid = 0;
356 356
         }
357 357
 	    elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED')
358 358
         {
359 359
             // Load translation files required by the page
360
-            $langs->loadLangs(array("agenda","other","interventions"));
360
+            $langs->loadLangs(array("agenda", "other", "interventions"));
361 361
 
362
-           	if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref);
363
-           	$object->actionmsg=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref);
362
+           	if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
363
+           	$object->actionmsg = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
364 364
 
365
-            $object->sendtoid=0;
365
+            $object->sendtoid = 0;
366 366
         }
367 367
         elseif ($action == 'FICHINTER_DELETE')
368 368
         {
369 369
             // Load translation files required by the page
370
-            $langs->loadLangs(array("agenda","other","interventions"));
370
+            $langs->loadLangs(array("agenda", "other", "interventions"));
371 371
 
372
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionDeletedInDolibarr",$object->ref);
373
-            $object->actionmsg=$langs->transnoentities("InterventionDeletedInDolibarr",$object->ref);
372
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
373
+            $object->actionmsg = $langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
374 374
 
375
-            $object->sendtoid=0;
376
-			$object->fk_element=0;
377
-			$object->elementtype='';
375
+            $object->sendtoid = 0;
376
+			$object->fk_element = 0;
377
+			$object->elementtype = '';
378 378
 		}
379 379
         elseif ($action == 'SHIPPING_VALIDATE')
380 380
         {
381 381
             // Load translation files required by the page
382
-            $langs->loadLangs(array("agenda","other","sendings"));
382
+            $langs->loadLangs(array("agenda", "other", "sendings"));
383 383
 
384
-        	if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated",($object->newref?$object->newref:$object->ref));
384
+        	if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref));
385 385
         	if (empty($object->actionmsg))
386 386
         	{
387
-        		$object->actionmsg=$langs->transnoentities("ShippingValidated",($object->newref?$object->newref:$object->ref));
387
+        		$object->actionmsg = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref));
388 388
         	}
389 389
 
390 390
         	// Parameters $object->sendtoid defined by caller
@@ -393,12 +393,12 @@  discard block
 block discarded – undo
393 393
 		elseif ($action == 'SHIPPING_SENTBYMAIL')
394 394
         {
395 395
             // Load translation files required by the page
396
-            $langs->loadLangs(array("agenda","other","sendings"));
396
+            $langs->loadLangs(array("agenda", "other", "sendings"));
397 397
 
398
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref);
398
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingSentByEMail", $object->ref);
399 399
             if (empty($object->actionmsg))
400 400
             {
401
-                $object->actionmsg=$langs->transnoentities("ShippingSentByEMail",$object->ref);
401
+                $object->actionmsg = $langs->transnoentities("ShippingSentByEMail", $object->ref);
402 402
             }
403 403
 
404 404
             // Parameters $object->sendtoid defined by caller
@@ -409,10 +409,10 @@  discard block
 block discarded – undo
409 409
             $langs->load("other");
410 410
         	$langs->load("receptions");
411 411
 
412
-        	if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ReceptionValidated",($object->newref?$object->newref:$object->ref));
412
+        	if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
413 413
         	if (empty($object->actionmsg))
414 414
         	{
415
-        		$object->actionmsg=$langs->transnoentities("ReceptionValidated",($object->newref?$object->newref:$object->ref));
415
+        		$object->actionmsg = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
416 416
         	}
417 417
 
418 418
         	// Parameters $object->sendtoid defined by caller
@@ -424,10 +424,10 @@  discard block
 block discarded – undo
424 424
             $langs->load("other");
425 425
             $langs->load("receptions");
426 426
 
427
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ReceptionSentByEMail",$object->ref);
427
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionSentByEMail", $object->ref);
428 428
             if (empty($object->actionmsg))
429 429
             {
430
-                $object->actionmsg=$langs->transnoentities("ReceptionSentByEMail",$object->ref);
430
+                $object->actionmsg = $langs->transnoentities("ReceptionSentByEMail", $object->ref);
431 431
             }
432 432
 
433 433
             // Parameters $object->sendtoid defined by caller
@@ -436,22 +436,22 @@  discard block
 block discarded – undo
436 436
 		elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE')
437 437
 		{
438 438
 			// Load translation files required by the page
439
-            $langs->loadLangs(array("agenda","other","propal"));
439
+            $langs->loadLangs(array("agenda", "other", "propal"));
440 440
 
441
-			if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
442
-			$object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
441
+			if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
442
+			$object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
443 443
 
444
-			$object->sendtoid=0;
444
+			$object->sendtoid = 0;
445 445
 		}
446 446
 		elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL')
447 447
 		{
448 448
 			// Load translation files required by the page
449
-            $langs->loadLangs(array("agenda","other","propal"));
449
+            $langs->loadLangs(array("agenda", "other", "propal"));
450 450
 
451
-			if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref);
451
+			if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref);
452 452
 			if (empty($object->actionmsg))
453 453
 			{
454
-				$object->actionmsg=$langs->transnoentities("ProposalSentByEMail",$object->ref);
454
+				$object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref);
455 455
 			}
456 456
 
457 457
 			// Parameters $object->sendtoid defined by caller
@@ -460,92 +460,92 @@  discard block
 block discarded – undo
460 460
 		elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED')
461 461
 		{
462 462
 			// Load translation files required by the page
463
-            $langs->loadLangs(array("agenda","other","propal"));
463
+            $langs->loadLangs(array("agenda", "other", "propal"));
464 464
 
465
-			if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
466
-			$object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
465
+			if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
466
+			$object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
467 467
 
468
-			$object->sendtoid=0;
468
+			$object->sendtoid = 0;
469 469
 		}
470 470
 		elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED')
471 471
 		{
472 472
 			// Load translation files required by the page
473
-            $langs->loadLangs(array("agenda","other","propal"));
473
+            $langs->loadLangs(array("agenda", "other", "propal"));
474 474
 
475
-			if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
476
-			$object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
475
+			if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
476
+			$object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
477 477
 
478
-			$object->sendtoid=0;
478
+			$object->sendtoid = 0;
479 479
 		}
480 480
 		elseif ($action == 'ORDER_SUPPLIER_CREATE')
481 481
         {
482 482
             // Load translation files required by the page
483
-            $langs->loadLangs(array("agenda","other","orders"));
483
+            $langs->loadLangs(array("agenda", "other", "orders"));
484 484
 
485
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref));
486
-            $object->actionmsg=$langs->transnoentities("OrderCreatedInDolibarr",($object->newref?$object->newref:$object->ref));
485
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
486
+            $object->actionmsg = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
487 487
 
488
-            $object->sendtoid=0;
488
+            $object->sendtoid = 0;
489 489
 		}
490 490
 		elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
491 491
         {
492 492
             // Load translation files required by the page
493
-            $langs->loadLangs(array("agenda","other","orders"));
493
+            $langs->loadLangs(array("agenda", "other", "orders"));
494 494
 
495
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
496
-            $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
495
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
496
+            $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
497 497
 
498
-            $object->sendtoid=0;
498
+            $object->sendtoid = 0;
499 499
 		}
500 500
 		elseif ($action == 'ORDER_SUPPLIER_APPROVE')
501 501
 		{
502 502
             // Load translation files required by the page
503
-            $langs->loadLangs(array("agenda","other","orders"));
503
+            $langs->loadLangs(array("agenda", "other", "orders"));
504 504
 
505
-			if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref);
506
-			$object->actionmsg=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref);
505
+			if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
506
+			$object->actionmsg = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
507 507
 
508
-			$object->sendtoid=0;
508
+			$object->sendtoid = 0;
509 509
 		}
510 510
 		elseif ($action == 'ORDER_SUPPLIER_REFUSE')
511 511
 		{
512 512
             // Load translation files required by the page
513
-            $langs->loadLangs(array("agenda","other","orders"));
513
+            $langs->loadLangs(array("agenda", "other", "orders"));
514 514
 
515
-			if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref);
516
-			$object->actionmsg=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref);
515
+			if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
516
+			$object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
517 517
 
518
-			$object->sendtoid=0;
518
+			$object->sendtoid = 0;
519 519
 		}
520 520
 		elseif ($action == 'ORDER_SUPPLIER_SUBMIT')
521 521
         {
522 522
             // Load translation files required by the page
523
-            $langs->loadLangs(array("agenda","other","orders"));
523
+            $langs->loadLangs(array("agenda", "other", "orders"));
524 524
 
525
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref));
526
-            $object->actionmsg=$langs->transnoentities("SupplierOrderSubmitedInDolibarr",($object->newref?$object->newref:$object->ref));
525
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
526
+            $object->actionmsg = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
527 527
 
528
-            $object->sendtoid=0;
528
+            $object->sendtoid = 0;
529 529
 		}
530 530
 		elseif ($action == 'ORDER_SUPPLIER_RECEIVE')
531 531
         {
532 532
             // Load translation files required by the page
533
-            $langs->loadLangs(array("agenda","other","orders"));
533
+            $langs->loadLangs(array("agenda", "other", "orders"));
534 534
 
535
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref));
536
-            $object->actionmsg=$langs->transnoentities("SupplierOrderReceivedInDolibarr",($object->newref?$object->newref:$object->ref));
535
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
536
+            $object->actionmsg = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
537 537
 
538
-            $object->sendtoid=0;
538
+            $object->sendtoid = 0;
539 539
 		}
540 540
 		elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
541 541
         {
542 542
             // Load translation files required by the page
543
-            $langs->loadLangs(array("agenda","other","bills","orders"));
543
+            $langs->loadLangs(array("agenda", "other", "bills", "orders"));
544 544
 
545
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref);
545
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
546 546
             if (empty($object->actionmsg))
547 547
             {
548
-                $object->actionmsg=$langs->transnoentities("SupplierOrderSentByEMail",$object->ref);
548
+                $object->actionmsg = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
549 549
             }
550 550
 
551 551
             // Parameters $object->sendtoid defined by caller
@@ -554,45 +554,45 @@  discard block
 block discarded – undo
554 554
 		elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED')
555 555
         {
556 556
             // Load translation files required by the page
557
-            $langs->loadLangs(array("agenda","other","bills","orders"));
557
+            $langs->loadLangs(array("agenda", "other", "bills", "orders"));
558 558
 
559
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderClassifiedBilled",$object->ref);
559
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
560 560
             if (empty($object->actionmsg))
561 561
             {
562
-                $object->actionmsg=$langs->transnoentities("SupplierOrderClassifiedBilled",$object->ref);
562
+                $object->actionmsg = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
563 563
             }
564 564
 
565
-            $object->sendtoid=0;
565
+            $object->sendtoid = 0;
566 566
         }
567 567
 		elseif ($action == 'BILL_SUPPLIER_VALIDATE')
568 568
         {
569 569
             // Load translation files required by the page
570
-            $langs->loadLangs(array("agenda","other","bills"));
570
+            $langs->loadLangs(array("agenda", "other", "bills"));
571 571
 
572
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
573
-            $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
572
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
573
+            $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
574 574
 
575
-            $object->sendtoid=0;
575
+            $object->sendtoid = 0;
576 576
 		}
577 577
 		elseif ($action == 'BILL_SUPPLIER_UNVALIDATE')
578 578
         {
579 579
             // Load translation files required by the page
580
-            $langs->loadLangs(array("agenda","other","bills"));
580
+            $langs->loadLangs(array("agenda", "other", "bills"));
581 581
 
582
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref);
583
-            $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref);
582
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
583
+            $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
584 584
 
585
-            $object->sendtoid=0;
585
+            $object->sendtoid = 0;
586 586
 		}
587 587
         elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL')
588 588
         {
589 589
             // Load translation files required by the page
590
-            $langs->loadLangs(array("agenda","other","bills","orders"));
590
+            $langs->loadLangs(array("agenda", "other", "bills", "orders"));
591 591
 
592
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref);
592
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
593 593
             if (empty($object->actionmsg))
594 594
             {
595
-                $object->actionmsg=$langs->transnoentities("SupplierInvoiceSentByEMail",$object->ref);
595
+                $object->actionmsg = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
596 596
             }
597 597
 
598 598
             // Parameters $object->sendtoid defined by caller
@@ -601,201 +601,201 @@  discard block
 block discarded – undo
601 601
 		elseif ($action == 'BILL_SUPPLIER_PAYED')
602 602
         {
603 603
             // Load translation files required by the page
604
-            $langs->loadLangs(array("agenda","other","bills"));
604
+            $langs->loadLangs(array("agenda", "other", "bills"));
605 605
 
606
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
607
-            $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
606
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
607
+            $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
608 608
 
609
-			$object->sendtoid=0;
609
+			$object->sendtoid = 0;
610 610
 		}
611 611
 		elseif ($action == 'BILL_SUPPLIER_CANCELED')
612 612
         {
613 613
             // Load translation files required by the page
614
-            $langs->loadLangs(array("agenda","other","bills"));
614
+            $langs->loadLangs(array("agenda", "other", "bills"));
615 615
 
616
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
617
-            $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
616
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
617
+            $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
618 618
 
619
-			$object->sendtoid=0;
619
+			$object->sendtoid = 0;
620 620
 		}
621 621
 
622 622
         // Members
623 623
         elseif ($action == 'MEMBER_VALIDATE')
624 624
         {
625 625
             // Load translation files required by the page
626
-            $langs->loadLangs(array("agenda","other","members"));
626
+            $langs->loadLangs(array("agenda", "other", "members"));
627 627
 
628
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs));
629
-            $object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs));
630
-            $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
631
-            $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
628
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
629
+            $object->actionmsg = $langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
630
+            $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
631
+            $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
632 632
 
633
-			$object->sendtoid=0;
633
+			$object->sendtoid = 0;
634 634
         }
635 635
 		elseif ($action == 'MEMBER_MODIFY')
636 636
         {
637 637
             // Load translation files required by the page
638
-            $langs->loadLangs(array("agenda","other","members"));
638
+            $langs->loadLangs(array("agenda", "other", "members"));
639 639
 
640
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs));
641
-            $object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs));
642
-            $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
643
-            $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
640
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
641
+            $object->actionmsg = $langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
642
+            $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
643
+            $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
644 644
 
645
-            $object->sendtoid=0;
645
+            $object->sendtoid = 0;
646 646
 		}
647 647
         elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE')
648 648
         {
649 649
             // Load translation files required by the page
650
-            $langs->loadLangs(array("agenda","other","members"));
650
+            $langs->loadLangs(array("agenda", "other", "members"));
651 651
 
652
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref,$object->getFullName($langs));
653
-            $object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref,$object->getFullName($langs));
654
-            $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
655
-            $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
656
-            $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
657
-            $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day');
652
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->ref, $object->getFullName($langs));
653
+            $object->actionmsg = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->ref, $object->getFullName($langs));
654
+            $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
655
+            $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
656
+            $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
657
+            $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
658 658
 
659
-			$object->sendtoid=0;
660
-			if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
659
+			$object->sendtoid = 0;
660
+			if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
661 661
         }
662 662
         elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY')
663 663
         {
664 664
         	// Load translation files required by the page
665
-            $langs->loadLangs(array("agenda","other","members"));
665
+            $langs->loadLangs(array("agenda", "other", "members"));
666 666
 
667
-        	if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->ref,$object->getFullName($langs));
668
-        	$object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr",$object->ref,$object->getFullName($langs));
669
-        	$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
670
-        	$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
671
-        	$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
672
-        	$object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day');
667
+        	if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->ref, $object->getFullName($langs));
668
+        	$object->actionmsg = $langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->ref, $object->getFullName($langs));
669
+        	$object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
670
+        	$object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
671
+        	$object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
672
+        	$object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
673 673
 
674
-        	$object->sendtoid=0;
675
-        	if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
674
+        	$object->sendtoid = 0;
675
+        	if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
676 676
         }
677 677
         elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE')
678 678
         {
679 679
         	// Load translation files required by the page
680
-            $langs->loadLangs(array("agenda","other","members"));
680
+            $langs->loadLangs(array("agenda", "other", "members"));
681 681
 
682
-        	if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->ref,$object->getFullName($langs));
683
-        	$object->actionmsg=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr",$object->ref,$object->getFullName($langs));
684
-        	$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
685
-        	$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
686
-        	$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
687
-        	$object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start,'day').' - '.dol_print_date($object->last_subscription_date_end,'day');
682
+        	if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
683
+        	$object->actionmsg = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
684
+        	$object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
685
+        	$object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
686
+        	$object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
687
+        	$object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
688 688
 
689
-        	$object->sendtoid=0;
690
-        	if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
689
+        	$object->sendtoid = 0;
690
+        	if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
691 691
         }
692 692
         elseif ($action == 'MEMBER_RESILIATE')
693 693
         {
694 694
             // Load translation files required by the page
695
-            $langs->loadLangs(array("agenda","other","members"));
695
+            $langs->loadLangs(array("agenda", "other", "members"));
696 696
 
697
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs));
698
-            $object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs));
699
-            $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
700
-            $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
697
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
698
+            $object->actionmsg = $langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
699
+            $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
700
+            $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
701 701
 
702
-			$object->sendtoid=0;
702
+			$object->sendtoid = 0;
703 703
         }
704 704
         elseif ($action == 'MEMBER_DELETE')
705 705
         {
706 706
             // Load translation files required by the page
707
-            $langs->loadLangs(array("agenda","other","members"));
707
+            $langs->loadLangs(array("agenda", "other", "members"));
708 708
 
709
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs));
710
-            $object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs));
711
-            $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
712
-            $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
709
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
710
+            $object->actionmsg = $langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
711
+            $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
712
+            $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
713 713
 
714
-			$object->sendtoid=0;
714
+			$object->sendtoid = 0;
715 715
         }
716 716
 
717 717
         // Projects
718 718
         elseif ($action == 'PROJECT_CREATE')
719 719
         {
720 720
             // Load translation files required by the page
721
-            $langs->loadLangs(array("agenda","other","projects"));
721
+            $langs->loadLangs(array("agenda", "other", "projects"));
722 722
 
723
-        	if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
724
-        	$object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
725
-        	$object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref;
723
+        	if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
724
+        	$object->actionmsg = $langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
725
+        	$object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref;
726 726
 
727
-        	$object->sendtoid=0;
727
+        	$object->sendtoid = 0;
728 728
         }
729
-        elseif($action == 'PROJECT_VALIDATE')
729
+        elseif ($action == 'PROJECT_VALIDATE')
730 730
         {
731 731
             // Load translation files required by the page
732
-            $langs->loadLangs(array("agenda","other","projects"));
732
+            $langs->loadLangs(array("agenda", "other", "projects"));
733 733
 
734
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref);
735
-            $object->actionmsg=$langs->transnoentities("ProjectValidatedInDolibarr",$object->ref);
736
-            $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref;
734
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
735
+            $object->actionmsg = $langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
736
+            $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref;
737 737
 
738
-            $object->sendtoid=0;
738
+            $object->sendtoid = 0;
739 739
         }
740
-        elseif($action == 'PROJECT_MODIFY')
740
+        elseif ($action == 'PROJECT_MODIFY')
741 741
         {
742 742
             // Load translation files required by the page
743
-            $langs->loadLangs(array("agenda","other","projects"));
743
+            $langs->loadLangs(array("agenda", "other", "projects"));
744 744
 
745
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref);
746
-            $object->actionmsg=$langs->transnoentities("ProjectModifiedInDolibarr",$object->ref);
747
-            $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
745
+            if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
746
+            $object->actionmsg = $langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
747
+            $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
748 748
 
749
-            $object->sendtoid=0;
749
+            $object->sendtoid = 0;
750 750
         }
751 751
 
752 752
 		// Project tasks
753
-		elseif($action == 'TASK_CREATE')
753
+		elseif ($action == 'TASK_CREATE')
754 754
 		{
755 755
             // Load translation files required by the page
756
-            $langs->loadLangs(array("agenda","other","projects"));
756
+            $langs->loadLangs(array("agenda", "other", "projects"));
757 757
 
758
-			if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskCreatedInDolibarr",$object->ref);
759
-			$object->actionmsg=$langs->transnoentities("TaskCreatedInDolibarr",$object->ref);
760
-			$object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
758
+			if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
759
+			$object->actionmsg = $langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
760
+			$object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
761 761
 
762
-			$object->sendtoid=0;
762
+			$object->sendtoid = 0;
763 763
 		}
764 764
 
765
-		elseif($action == 'TASK_MODIFY')
765
+		elseif ($action == 'TASK_MODIFY')
766 766
 		{
767 767
             // Load translation files required by the page
768
-            $langs->loadLangs(array("agenda","other","projects"));
768
+            $langs->loadLangs(array("agenda", "other", "projects"));
769 769
 
770
-			if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr",$object->ref);
771
-			$object->actionmsg=$langs->transnoentities("TaskModifieddInDolibarr",$object->ref);
772
-			$object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
770
+			if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskModifiedInDolibarr", $object->ref);
771
+			$object->actionmsg = $langs->transnoentities("TaskModifieddInDolibarr", $object->ref);
772
+			$object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
773 773
 
774
-			$object->sendtoid=0;
774
+			$object->sendtoid = 0;
775 775
 		}
776 776
 
777
-		elseif($action == 'TASK_DELETE')
777
+		elseif ($action == 'TASK_DELETE')
778 778
 		{
779 779
             // Load translation files required by the page
780
-            $langs->loadLangs(array("agenda","other","projects"));
780
+            $langs->loadLangs(array("agenda", "other", "projects"));
781 781
 
782
-			if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref);
783
-			$object->actionmsg=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref);
784
-			$object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
782
+			if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
783
+			$object->actionmsg = $langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
784
+			$object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
785 785
 
786
-			$object->sendtoid=0;
786
+			$object->sendtoid = 0;
787 787
 		}
788 788
 		// TODO Merge all previous cases into this generic one
789 789
 		else	// $action = TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ...
790 790
 		{
791 791
 		    // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function)
792 792
 		    // Load translation files required by the page
793
-            $langs->loadLangs(array("agenda","other"));
793
+            $langs->loadLangs(array("agenda", "other"));
794 794
 
795
-		    if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities($action."InDolibarr",$object->ref);
796
-		    if (empty($object->actionmsg))  $object->actionmsg=$langs->transnoentities($action."InDolibarr",$object->ref);
795
+		    if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", $object->ref);
796
+		    if (empty($object->actionmsg))  $object->actionmsg = $langs->transnoentities($action."InDolibarr", $object->ref);
797 797
 
798
-		    $object->sendtoid=0;
798
+		    $object->sendtoid = 0;
799 799
 		}
800 800
 
801 801
 		$object->actionmsg = $langs->transnoentities("Author").': '.$user->login."\n".$object->actionmsg;
@@ -803,21 +803,21 @@  discard block
 block discarded – undo
803 803
 		dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
804 804
 
805 805
         // Add entry in event table
806
-		$now=dol_now();
806
+		$now = dol_now();
807 807
 
808 808
 		if (isset($_SESSION['listofnames-'.$object->trackid]))
809 809
 		{
810
-			$attachs=$_SESSION['listofnames-'.$object->trackid];
811
-			if ($attachs && strpos($action,'SENTBYMAIL'))
810
+			$attachs = $_SESSION['listofnames-'.$object->trackid];
811
+			if ($attachs && strpos($action, 'SENTBYMAIL'))
812 812
 			{
813
-                $object->actionmsg=dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);
813
+                $object->actionmsg = dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);
814 814
 			}
815 815
 		}
816 816
 
817 817
         require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
818 818
         require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
819
-		$contactforaction=new Contact($this->db);
820
-        $societeforaction=new Societe($this->db);
819
+		$contactforaction = new Contact($this->db);
820
+        $societeforaction = new Societe($this->db);
821 821
         // Set contactforaction if there is only 1 contact.
822 822
         if (is_array($object->sendtoid))
823 823
         {
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
         if ($object->socid > 0)			$societeforaction->fetch($object->socid);
832 832
         elseif ($object->fk_soc > 0)	$societeforaction->fetch($object->fk_soc);
833 833
 
834
-        $projectid = isset($object->fk_project)?$object->fk_project:0;
834
+        $projectid = isset($object->fk_project) ? $object->fk_project : 0;
835 835
         if ($object->element == 'project') $projectid = $object->id;
836 836
 
837 837
         $elementid = $object->id;
@@ -846,22 +846,22 @@  discard block
 block discarded – undo
846 846
 		// Insertion action
847 847
 		require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
848 848
 		$actioncomm = new ActionComm($this->db);
849
-		$actioncomm->type_code   = $object->actiontypecode;		// Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
849
+		$actioncomm->type_code   = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
850 850
 		$actioncomm->code        = 'AC_'.$action;
851 851
 		$actioncomm->label       = $object->actionmsg2;
852
-		$actioncomm->note        = $object->actionmsg;          // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg)
852
+		$actioncomm->note        = $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg)
853 853
 		$actioncomm->fk_project  = $projectid;
854 854
 		$actioncomm->datep       = $now;
855 855
 		$actioncomm->datef       = $now;
856 856
 		$actioncomm->durationp   = 0;
857 857
 		$actioncomm->punctual    = 1;
858
-		$actioncomm->percentage  = -1;   // Not applicable
858
+		$actioncomm->percentage  = -1; // Not applicable
859 859
 		$actioncomm->societe     = $societeforaction;
860 860
 		$actioncomm->contact     = $contactforaction;
861 861
 		$actioncomm->socid       = $societeforaction->id;
862 862
 		$actioncomm->contactid   = $contactforaction->id;
863
-		$actioncomm->authorid    = $user->id;   // User saving action
864
-		$actioncomm->userownerid = $user->id;	// Owner of action
863
+		$actioncomm->authorid    = $user->id; // User saving action
864
+		$actioncomm->userownerid = $user->id; // Owner of action
865 865
         // Fields defined when action is an email (content should be into object->actionmsg to be added into note, subject into object->actionms2 to be added into label)
866 866
 		$actioncomm->email_msgid   = $object->email_msgid;
867 867
 		$actioncomm->email_from    = $object->email_from;
@@ -874,28 +874,28 @@  discard block
 block discarded – undo
874 874
 
875 875
 		// Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
876 876
 		// for such objects because there is already a dedicated field into table llx_actioncomm.
877
-		if (! in_array($elementtype, array('societe','contact','project')))
877
+		if (!in_array($elementtype, array('societe', 'contact', 'project')))
878 878
 		{
879 879
 			$actioncomm->fk_element  = $elementid;
880 880
 			$actioncomm->elementtype = $elementtype;
881 881
 		}
882 882
 
883
-		if (property_exists($object,'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles)>0) {
884
-			$actioncomm->attachedfiles=$object->attachedfiles;
883
+		if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles) > 0) {
884
+			$actioncomm->attachedfiles = $object->attachedfiles;
885 885
 		}
886
-		if (property_exists($object,'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid)>0) {
887
-			$actioncomm->userassigned=$object->sendtouserid;
886
+		if (property_exists($object, 'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid) > 0) {
887
+			$actioncomm->userassigned = $object->sendtouserid;
888 888
 		}
889 889
 
890
-		$ret=$actioncomm->create($user);       // User creating action
890
+		$ret = $actioncomm->create($user); // User creating action
891 891
 
892 892
 		if ($ret > 0 && $conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO)
893 893
 		{
894
-			if (is_array($object->attachedfiles) && array_key_exists('paths',$object->attachedfiles) && count($object->attachedfiles['paths'])>0) {
895
-				foreach($object->attachedfiles['paths'] as $key=>$filespath) {
894
+			if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) {
895
+				foreach ($object->attachedfiles['paths'] as $key=>$filespath) {
896 896
 					$srcfile = $filespath;
897
-					$destdir = $conf->agenda->dir_output . '/' . $ret;
898
-					$destfile = $destdir . '/' . $object->attachedfiles['names'][$key];
897
+					$destdir = $conf->agenda->dir_output.'/'.$ret;
898
+					$destfile = $destdir.'/'.$object->attachedfiles['names'][$key];
899 899
 					if (dol_mkdir($destdir) >= 0) {
900 900
 						require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
901 901
 						dol_copy($srcfile, $destfile);
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 			}
905 905
 		}
906 906
 
907
-		unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode);	// When several action are called on same object, we must be sure to not reuse value of first action.
907
+		unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action.
908 908
 
909 909
 		if ($ret > 0)
910 910
 		{
@@ -913,9 +913,9 @@  discard block
 block discarded – undo
913 913
 		}
914 914
 		else
915 915
 		{
916
-            $error ="Failed to insert event : ".$actioncomm->error." ".join(',',$actioncomm->errors);
917
-            $this->error=$error;
918
-            $this->errors=$actioncomm->errors;
916
+            $error = "Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors);
917
+            $this->error = $error;
918
+            $this->errors = $actioncomm->errors;
919 919
 
920 920
             dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);
921 921
             return -1;
Please login to merge, or discard this patch.
core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
58 58
 	{
59
-        if (empty($conf->mailmanspip->enabled)) return 0;     // Module not active, we do nothing
59
+        if (empty($conf->mailmanspip->enabled)) return 0; // Module not active, we do nothing
60 60
 
61 61
         require_once DOL_DOCUMENT_ROOT."/mailmanspip/class/mailmanspip.class.php";
62 62
         require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php";
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
         	// We add subscription if we change category (new category may means more mailing-list to subscribe)
69 69
         	if (is_object($object->context['linkto']) && method_exists($object->context['linkto'], 'add_to_abo') && $object->context['linkto']->add_to_abo() < 0)
70 70
     		{
71
-    			$this->error=$object->context['linkto']->error;
72
-    			$this->errors=$object->context['linkto']->errors;
73
-    			$return=-1;
71
+    			$this->error = $object->context['linkto']->error;
72
+    			$this->errors = $object->context['linkto']->errors;
73
+    			$return = -1;
74 74
     		}
75 75
 			else
76 76
 			{
77
-				$return=1;
77
+				$return = 1;
78 78
 			}
79 79
 
80 80
         	return $return;
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
         	// We remove subscription if we change category (lessw category may means less mailing-list to subscribe)
87 87
         	if (is_object($object->context['unlinkoff']) && method_exists($object->context['unlinkoff'], 'del_to_abo') && $object->context['unlinkoff']->del_to_abo() < 0)
88 88
         	{
89
-        		$this->error=$object->context['unlinkoff']->error;
90
-        		$this->errors=$object->context['unlinkoff']->errors;
91
-        		$return=-1;
89
+        		$this->error = $object->context['unlinkoff']->error;
90
+        		$this->errors = $object->context['unlinkoff']->errors;
91
+        		$return = -1;
92 92
         	}
93 93
         	else
94 94
         	{
95
-        		$return=1;
95
+        		$return = 1;
96 96
         	}
97 97
 
98 98
         	return $return;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         {
104 104
             dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
105 105
 
106
-			$return=0;
106
+			$return = 0;
107 107
             // Add user into some linked tools (mailman, spip, etc...)
108 108
 			if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))	// TODO Do del/add also if type change
109 109
 			{
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 				{
112 112
 					if ($object->oldcopy->del_to_abo() < 0)
113 113
 					{
114
-						if (! empty($object->oldcopy->error)) $this->error=$object->oldcopy->error;
115
-						$this->errors=$object->oldcopy->errors;
116
-						$return=-1;
114
+						if (!empty($object->oldcopy->error)) $this->error = $object->oldcopy->error;
115
+						$this->errors = $object->oldcopy->errors;
116
+						$return = -1;
117 117
 					}
118 118
 					else
119 119
 					{
120
-						$return=1;
120
+						$return = 1;
121 121
 					}
122 122
 				}
123 123
     			// We add subscription if new email or new type (new type may means more mailing-list to subscribe)
124 124
     			if ($object->add_to_abo() < 0)
125 125
     			{
126
-    				 if (! empty($object->error)) $this->error=$object->error;
127
-    				 $this->errors=$object->errors;
128
-    				 $return=-1;
126
+    				 if (!empty($object->error)) $this->error = $object->error;
127
+    				 $this->errors = $object->errors;
128
+    				 $return = -1;
129 129
     			}
130 130
 				else
131 131
 				{
132
-					$return=1;
132
+					$return = 1;
133 133
 				}
134 134
 			}
135 135
 
@@ -139,17 +139,17 @@  discard block
 block discarded – undo
139 139
         {
140 140
             dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
141 141
 
142
-            $return=0;
142
+            $return = 0;
143 143
             // Remove from external tools (mailman, spip, etc...)
144 144
         	if ($object->del_to_abo() < 0)
145 145
 			{
146
-				if (! empty($object->error)) $this->error=$object->error;
147
-				$this->errors=$object->errors;
148
-				$return=-1;
146
+				if (!empty($object->error)) $this->error = $object->error;
147
+				$this->errors = $object->errors;
148
+				$return = -1;
149 149
 			}
150 150
 			else
151 151
 			{
152
-				$return=1;
152
+				$return = 1;
153 153
 			}
154 154
 
155 155
 	        return $return;
Please login to merge, or discard this patch.
htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
61 61
     {
62
-        if (empty($conf->workflow->enabled)) return 0;     // Module not active, we do nothing
62
+        if (empty($conf->workflow->enabled)) return 0; // Module not active, we do nothing
63 63
 
64 64
         // Proposals to order
65 65
         if ($action == 'PROPAL_CLOSE_SIGNED')
66 66
         {
67 67
         	dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
68
-            if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER))
68
+            if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER))
69 69
             {
70 70
                 include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
71 71
                 $newobject = new Commande($this->db);
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
                 $newobject->context['origin'] = $object->element;
75 75
                 $newobject->context['origin_id'] = $object->id;
76 76
 
77
-                $ret=$newobject->createFromProposal($object, $user);
78
-                if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; }
77
+                $ret = $newobject->createFromProposal($object, $user);
78
+                if ($ret < 0) { $this->error = $newobject->error; $this->errors[] = $newobject->error; }
79 79
                 return $ret;
80 80
             }
81 81
         }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         if ($action == 'ORDER_CLOSE')
85 85
         {
86 86
             dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
87
-            if (! empty($conf->facture->enabled) && ! empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE))
87
+            if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_ORDER_AUTOCREATE_INVOICE))
88 88
             {
89 89
                 include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
90 90
                 $newobject = new Facture($this->db);
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
                 $newobject->context['origin'] = $object->element;
94 94
                 $newobject->context['origin_id'] = $object->id;
95 95
 
96
-                $ret=$newobject->createFromOrder($object, $user);
97
-                if ($ret < 0) { $this->error=$newobject->error; $this->errors[]=$newobject->error; }
96
+                $ret = $newobject->createFromOrder($object, $user);
97
+                if ($ret < 0) { $this->error = $newobject->error; $this->errors[] = $newobject->error; }
98 98
                 return $ret;
99 99
             }
100 100
         }
@@ -102,23 +102,23 @@  discard block
 block discarded – undo
102 102
         // Order classify billed proposal
103 103
         if ($action == 'ORDER_CLASSIFY_BILLED')
104 104
         {
105
-        	dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
106
-        	if (! empty($conf->propal->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL))
105
+        	dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
106
+        	if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL))
107 107
         	{
108
-        		$object->fetchObjectLinked('','propal',$object->id,$object->element);
109
-				if (! empty($object->linkedObjects))
108
+        		$object->fetchObjectLinked('', 'propal', $object->id, $object->element);
109
+				if (!empty($object->linkedObjects))
110 110
 				{
111
-				    $totalonlinkedelements=0;
112
-					foreach($object->linkedObjects['propal'] as $element)
111
+				    $totalonlinkedelements = 0;
112
+					foreach ($object->linkedObjects['propal'] as $element)
113 113
 					{
114 114
 					    if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
115 115
 					}
116
-					dol_syslog( "Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) );
117
-					if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
116
+					dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
117
+					if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)))
118 118
 					{
119
-    					foreach($object->linkedObjects['propal'] as $element)
119
+    					foreach ($object->linkedObjects['propal'] as $element)
120 120
     					{
121
-    					    $ret=$element->classifyBilled($user);
121
+    					    $ret = $element->classifyBilled($user);
122 122
     					}
123 123
 					}
124 124
 				}
@@ -129,25 +129,25 @@  discard block
 block discarded – undo
129 129
         // classify billed order & billed propososal
130 130
         if ($action == 'BILL_VALIDATE')
131 131
         {
132
-        	dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
132
+        	dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
133 133
 
134 134
 			// First classify billed the order to allow the proposal classify process
135
-			if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
135
+			if (!empty($conf->commande->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
136 136
         	{
137
-        		$object->fetchObjectLinked('','commande',$object->id,$object->element);
138
-        		if (! empty($object->linkedObjects))
137
+        		$object->fetchObjectLinked('', 'commande', $object->id, $object->element);
138
+        		if (!empty($object->linkedObjects))
139 139
         		{
140
-        		    $totalonlinkedelements=0;
141
-        		    foreach($object->linkedObjects['commande'] as $element)
140
+        		    $totalonlinkedelements = 0;
141
+        		    foreach ($object->linkedObjects['commande'] as $element)
142 142
         		    {
143 143
         		        if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
144 144
         		    }
145
-        		    dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) );
146
-        		    if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
145
+        		    dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
146
+        		    if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)))
147 147
         		    {
148
-        		        foreach($object->linkedObjects['commande'] as $element)
148
+        		        foreach ($object->linkedObjects['commande'] as $element)
149 149
         		        {
150
-        		            $ret=$element->classifyBilled($user);
150
+        		            $ret = $element->classifyBilled($user);
151 151
         		        }
152 152
         		    }
153 153
         		}
@@ -155,22 +155,22 @@  discard block
 block discarded – undo
155 155
         	}
156 156
 
157 157
 			// Second classify billed the proposal.
158
-        	if (! empty($conf->propal->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL))
158
+        	if (!empty($conf->propal->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL))
159 159
         	{
160
-        		$object->fetchObjectLinked('','propal',$object->id,$object->element);
161
-        		if (! empty($object->linkedObjects))
160
+        		$object->fetchObjectLinked('', 'propal', $object->id, $object->element);
161
+        		if (!empty($object->linkedObjects))
162 162
         		{
163
-        		    $totalonlinkedelements=0;
164
-        		    foreach($object->linkedObjects['propal'] as $element)
163
+        		    $totalonlinkedelements = 0;
164
+        		    foreach ($object->linkedObjects['propal'] as $element)
165 165
         		    {
166 166
         		        if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
167 167
         		    }
168
-        		    dol_syslog( "Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) );
169
-        		    if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
168
+        		    dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
169
+        		    if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)))
170 170
         		    {
171
-        		        foreach($object->linkedObjects['propal'] as $element)
171
+        		        foreach ($object->linkedObjects['propal'] as $element)
172 172
         		        {
173
-        		            $ret=$element->classifyBilled($user);
173
+        		            $ret = $element->classifyBilled($user);
174 174
         		        }
175 175
         		    }
176 176
         		}
@@ -181,25 +181,25 @@  discard block
 block discarded – undo
181 181
         // classify billed order & billed propososal
182 182
         if ($action == 'BILL_SUPPLIER_VALIDATE')
183 183
         {
184
-        	dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
184
+        	dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
185 185
 
186 186
         	// First classify billed the order to allow the proposal classify process
187
-        	if (! empty($conf->fournisseur->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER))
187
+        	if (!empty($conf->fournisseur->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER))
188 188
         	{
189
-        		$object->fetchObjectLinked('','order_supplier',$object->id,$object->element);
190
-        		if (! empty($object->linkedObjects))
189
+        		$object->fetchObjectLinked('', 'order_supplier', $object->id, $object->element);
190
+        		if (!empty($object->linkedObjects))
191 191
         		{
192
-        			$totalonlinkedelements=0;
193
-        			foreach($object->linkedObjects['order_supplier'] as $element)
192
+        			$totalonlinkedelements = 0;
193
+        			foreach ($object->linkedObjects['order_supplier'] as $element)
194 194
         			{
195 195
         				if ($element->statut == CommandeFournisseur::STATUS_ACCEPTED || $element->statut == CommandeFournisseur::STATUS_ORDERSENT || $element->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $totalonlinkedelements += $element->total_ht;
196 196
         			}
197
-        			dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) );
198
-        			if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
197
+        			dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
198
+        			if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)))
199 199
         			{
200
-        				foreach($object->linkedObjects['order_supplier'] as $element)
200
+        				foreach ($object->linkedObjects['order_supplier'] as $element)
201 201
         				{
202
-        					$ret=$element->classifyBilled($user);
202
+        					$ret = $element->classifyBilled($user);
203 203
         				}
204 204
         			}
205 205
         		}
@@ -207,22 +207,22 @@  discard block
 block discarded – undo
207 207
         	}
208 208
 
209 209
         	// Second classify billed the proposal.
210
-        	if (! empty($conf->supplier_proposal->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL))
210
+        	if (!empty($conf->supplier_proposal->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_SUPPLIER_PROPOSAL))
211 211
         	{
212
-        		$object->fetchObjectLinked('','supplier_proposal',$object->id,$object->element);
213
-        		if (! empty($object->linkedObjects))
212
+        		$object->fetchObjectLinked('', 'supplier_proposal', $object->id, $object->element);
213
+        		if (!empty($object->linkedObjects))
214 214
         		{
215
-        			$totalonlinkedelements=0;
216
-        			foreach($object->linkedObjects['supplier_proposal'] as $element)
215
+        			$totalonlinkedelements = 0;
216
+        			foreach ($object->linkedObjects['supplier_proposal'] as $element)
217 217
         			{
218 218
         				if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
219 219
         			}
220
-        			dol_syslog( "Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) );
221
-        			if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
220
+        			dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
221
+        			if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)))
222 222
         			{
223
-        				foreach($object->linkedObjects['supplier_proposal'] as $element)
223
+        				foreach ($object->linkedObjects['supplier_proposal'] as $element)
224 224
         				{
225
-        					$ret=$element->classifyBilled($user);
225
+        					$ret = $element->classifyBilled($user);
226 226
         				}
227 227
         			}
228 228
         		}
@@ -233,24 +233,24 @@  discard block
 block discarded – undo
233 233
         // Invoice classify billed order
234 234
         if ($action == 'BILL_PAYED')
235 235
         {
236
-            dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
236
+            dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
237 237
 
238
-            if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER))
238
+            if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER))
239 239
             {
240
-                $object->fetchObjectLinked('','commande',$object->id,$object->element);
241
-                if (! empty($object->linkedObjects))
240
+                $object->fetchObjectLinked('', 'commande', $object->id, $object->element);
241
+                if (!empty($object->linkedObjects))
242 242
                 {
243
-                    $totalonlinkedelements=0;
244
-                    foreach($object->linkedObjects['commande'] as $element)
243
+                    $totalonlinkedelements = 0;
244
+                    foreach ($object->linkedObjects['commande'] as $element)
245 245
                     {
246 246
                         if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
247 247
                     }
248
-                    dol_syslog( "Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht) );
249
-                    if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
248
+                    dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
249
+                    if (($totalonlinkedelements == $object->total_ht) || (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)))
250 250
                     {
251
-                        foreach($object->linkedObjects['commande'] as $element)
251
+                        foreach ($object->linkedObjects['commande'] as $element)
252 252
                         {
253
-                            $ret=$element->classifyBilled($user);
253
+                            $ret = $element->classifyBilled($user);
254 254
                         }
255 255
                     }
256 256
                 }
@@ -258,36 +258,36 @@  discard block
 block discarded – undo
258 258
             }
259 259
         }
260 260
 
261
-        if ($action=='SHIPPING_VALIDATE')
261
+        if ($action == 'SHIPPING_VALIDATE')
262 262
         {
263
-        	dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
263
+        	dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
264 264
 
265
-        	if (! empty($conf->commande->enabled) && ! empty($conf->expedition->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING))
265
+        	if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING))
266 266
         	{
267
-        		$qtyshipped=array();
268
-        		$qtyordred=array();
267
+        		$qtyshipped = array();
268
+        		$qtyordred = array();
269 269
         		require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
270 270
 
271 271
         		//find all shippement on order origin
272 272
         		$order = new Commande($this->db);
273
-        		$ret=$order->fetch($object->origin_id);
274
-        		if ($ret<0) {
275
-        			$this->error=$order->error; $this->errors=$order->errors;
273
+        		$ret = $order->fetch($object->origin_id);
274
+        		if ($ret < 0) {
275
+        			$this->error = $order->error; $this->errors = $order->errors;
276 276
         			return $ret;
277 277
         		}
278
-        		$ret=$order->fetchObjectLinked($order->id,'commande',null,'shipping');
279
-        		if ($ret<0) {
280
-        			$this->error=$order->error; $this->errors=$order->errors;
278
+        		$ret = $order->fetchObjectLinked($order->id, 'commande', null, 'shipping');
279
+        		if ($ret < 0) {
280
+        			$this->error = $order->error; $this->errors = $order->errors;
281 281
         			return $ret;
282 282
         		}
283 283
         		//Build array of quantity shipped by product for an order
284
-        		if (is_array($order->linkedObjects) && count($order->linkedObjects)>0) {
285
-        			foreach($order->linkedObjects as $type=>$shipping_array) {
286
-        				if ($type=='shipping' && is_array($shipping_array) && count($shipping_array)>0) {
284
+        		if (is_array($order->linkedObjects) && count($order->linkedObjects) > 0) {
285
+        			foreach ($order->linkedObjects as $type=>$shipping_array) {
286
+        				if ($type == 'shipping' && is_array($shipping_array) && count($shipping_array) > 0) {
287 287
         					foreach ($shipping_array as $shipping) {
288
-		        				if (is_array($shipping->lines) && count($shipping->lines)>0) {
289
-		        					foreach($shipping->lines as $shippingline) {
290
-		        						$qtyshipped[$shippingline->fk_product]+=$shippingline->qty;
288
+		        				if (is_array($shipping->lines) && count($shipping->lines) > 0) {
289
+		        					foreach ($shipping->lines as $shippingline) {
290
+		        						$qtyshipped[$shippingline->fk_product] += $shippingline->qty;
291 291
 		        					}
292 292
 		        				}
293 293
 	        				}
@@ -296,20 +296,20 @@  discard block
 block discarded – undo
296 296
         		}
297 297
 
298 298
         		//Build array of quantity ordered by product
299
-        		if (is_array($order->lines) && count($order->lines)>0) {
300
-        			foreach($order->lines as $orderline) {
301
-        				$qtyordred[$orderline->fk_product]+=$orderline->qty;
299
+        		if (is_array($order->lines) && count($order->lines) > 0) {
300
+        			foreach ($order->lines as $orderline) {
301
+        				$qtyordred[$orderline->fk_product] += $orderline->qty;
302 302
         			}
303 303
         		}
304 304
         		//dol_syslog(var_export($qtyordred,true),LOG_DEBUG);
305 305
         		//dol_syslog(var_export($qtyshipped,true),LOG_DEBUG);
306 306
         		//Compare array
307
-        		$diff_array=array_diff_assoc($qtyordred,$qtyshipped);
308
-        		if (count($diff_array)==0) {
307
+        		$diff_array = array_diff_assoc($qtyordred, $qtyshipped);
308
+        		if (count($diff_array) == 0) {
309 309
         			//No diff => mean everythings is shipped
310
-        			$ret=$object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin);
311
-        			if ($ret<0) {
312
-        				$this->error=$object->error; $this->errors=$object->errors;
310
+        			$ret = $object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin);
311
+        			if ($ret < 0) {
312
+        				$this->error = $object->error; $this->errors = $object->errors;
313 313
         				return $ret;
314 314
         			}
315 315
         		}
@@ -320,22 +320,22 @@  discard block
 block discarded – undo
320 320
         {
321 321
         	dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);
322 322
 
323
-        	if (! empty($conf->reception->enabled) && ! empty($conf->global->WORKFLOW_BILL_ON_RECEPTION))
323
+        	if (!empty($conf->reception->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION))
324 324
         	{
325
-        		$object->fetchObjectLinked('','reception',$object->id,$object->element);
326
-        		if (! empty($object->linkedObjects))
325
+        		$object->fetchObjectLinked('', 'reception', $object->id, $object->element);
326
+        		if (!empty($object->linkedObjects))
327 327
         		{
328
-        		    $totalonlinkedelements=0;
329
-        		    foreach($object->linkedObjects['reception'] as $element)
328
+        		    $totalonlinkedelements = 0;
329
+        		    foreach ($object->linkedObjects['reception'] as $element)
330 330
         		    {
331 331
         		        if ($element->statut == Reception::STATUS_VALIDATED) $totalonlinkedelements += $element->total_ht;
332 332
         		    }
333 333
         		    dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
334 334
         		    if ($totalonlinkedelements == $object->total_ht)
335 335
         		    {
336
-        		        foreach($object->linkedObjects['reception'] as $element)
336
+        		        foreach ($object->linkedObjects['reception'] as $element)
337 337
         		        {
338
-        		            $ret=$element->set_billed();
338
+        		            $ret = $element->set_billed();
339 339
         		        }
340 340
         		    }
341 341
         		}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
     	switch ($action) {
113 113
     		case 'TICKET_ASSIGNED':
114
-	            dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
114
+	            dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
115 115
 
116 116
 	            if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id)
117 117
 	            {
@@ -127,25 +127,25 @@  discard block
 block discarded – undo
127 127
 	                		$mimetype = array();
128 128
 
129 129
 	                		// Send email to assigned user
130
-		                    $subject = '[' . $conf->global->MAIN_INFO_SOCIETE_NOM . '] ' . $langs->transnoentities('TicketAssignedToYou');
131
-		                    $message = '<p>' . $langs->transnoentities('TicketAssignedEmailBody', $object->track_id, dolGetFirstLastname($user->firstname, $user->lastname)) . "</p>";
132
-		                    $message .= '<ul><li>' . $langs->trans('Title') . ' : ' . $object->subject . '</li>';
133
-		                    $message .= '<li>' . $langs->trans('Type') . ' : ' . $object->type_label . '</li>';
134
-		                    $message .= '<li>' . $langs->trans('Category') . ' : ' . $object->category_label . '</li>';
135
-		                    $message .= '<li>' . $langs->trans('Severity') . ' : ' . $object->severity_label . '</li>';
130
+		                    $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketAssignedToYou');
131
+		                    $message = '<p>'.$langs->transnoentities('TicketAssignedEmailBody', $object->track_id, dolGetFirstLastname($user->firstname, $user->lastname))."</p>";
132
+		                    $message .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
133
+		                    $message .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
134
+		                    $message .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
135
+		                    $message .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
136 136
 		                    // Extrafields
137 137
 		                    if (is_array($object->array_options) && count($object->array_options) > 0) {
138 138
 		                        foreach ($object->array_options as $key => $value) {
139
-	                                $message .= '<li>' . $langs->trans($key) . ' : ' . $value . '</li>';
139
+	                                $message .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
140 140
 		                        }
141 141
 		                    }
142 142
 
143 143
 		                    $message .= '</ul>';
144
-		                    $message .= '<p>' . $langs->trans('Message') . ' : <br>' . $object->message . '</p>';
145
-		                    $message .= '<p><a href="' . dol_buildpath('/ticket/card.php', 2) . '?track_id=' . $object->track_id . '">' . $langs->trans('SeeThisTicketIntomanagementInterface') . '</a></p>';
144
+		                    $message .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
145
+		                    $message .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
146 146
 
147 147
 		                    $sendto = $userstat->email;
148
-		                    $from = dolGetFirstLastname($user->firstname, $user->lastname) . '<' . $user->email . '>';
148
+		                    $from = dolGetFirstLastname($user->firstname, $user->lastname).'<'.$user->email.'>';
149 149
 
150 150
 	                        $message = dol_nl2br($message);
151 151
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	                            $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
154 154
 	                            $conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
155 155
 	                        }
156
-	                        include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
156
+	                        include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
157 157
 		                    $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1);
158 158
 		                    if ($mailfile->error) {
159 159
 	                            setEventMessages($mailfile->error, $mailfile->errors, 'errors');
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	            break;
177 177
 
178 178
     		case 'TICKET_CREATE':
179
-	            dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
179
+	            dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
180 180
 
181 181
 	            $langs->load('ticket');
182 182
 
183
-	            $object->fetch('', $object->track_id);	// Should be useless
183
+	            $object->fetch('', $object->track_id); // Should be useless
184 184
 
185 185
 
186 186
 	            // Send email to notification email
@@ -198,27 +198,27 @@  discard block
 block discarded – undo
198 198
 
199 199
 						/* Send email to admin */
200 200
 			            $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin');
201
-			            $message_admin= $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n";
202
-			            $message_admin.='<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
203
-			            $message_admin.='<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
204
-			            $message_admin.='<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
205
-			            $message_admin.='<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
206
-			            $message_admin.='<li>'.$langs->trans('From').' : '.( $object->email_from ? $object->email_from : ( $object->fk_user_create > 0 ? $langs->trans('Internal') : '') ).'</li>';
201
+			            $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n";
202
+			            $message_admin .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
203
+			            $message_admin .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
204
+			            $message_admin .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
205
+			            $message_admin .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
206
+			            $message_admin .= '<li>'.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'</li>';
207 207
 			            // Extrafields
208 208
 			            if (is_array($object->array_options) && count($object->array_options) > 0) {
209 209
 			                foreach ($object->array_options as $key => $value) {
210
-			                      $message_admin.='<li>'.$langs->trans($key).' : '.$value.'</li>';
210
+			                      $message_admin .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
211 211
 			                }
212 212
 			            }
213
-			            $message_admin.='</ul>';
213
+			            $message_admin .= '</ul>';
214 214
 
215 215
 			            if ($object->fk_soc > 0) {
216 216
 			                      $object->fetch_thirdparty();
217
-			                      $message_admin.='<p>'.$langs->trans('Company'). ' : '.$object->thirdparty->name.'</p>';
217
+			                      $message_admin .= '<p>'.$langs->trans('Company').' : '.$object->thirdparty->name.'</p>';
218 218
 			            }
219 219
 
220
-			            $message_admin.='<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
221
-			            $message_admin.='<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
220
+			            $message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
221
+			            $message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
222 222
 
223 223
 			            $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
224 224
 			            $replyto = $from;
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 			            if ($mailfile->error) {
235 235
 		                    dol_syslog($mailfile->error, LOG_DEBUG);
236 236
 			            } else {
237
-			                     $result=$mailfile->sendfile();
237
+			                     $result = $mailfile->sendfile();
238 238
 			            }
239 239
 		                if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
240 240
 		                    $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
 		            	$mimetype = array();
262 262
 
263 263
 		            	$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectCustomer');
264
-			            $message_customer= $langs->transnoentities('TicketNewEmailBodyCustomer', $object->track_id)."\n\n";
265
-			            $message_customer.='<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
266
-			            $message_customer.='<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
267
-			            $message_customer.='<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
268
-			            $message_customer.='<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
264
+			            $message_customer = $langs->transnoentities('TicketNewEmailBodyCustomer', $object->track_id)."\n\n";
265
+			            $message_customer .= '<ul><li>'.$langs->trans('Title').' : '.$object->subject.'</li>';
266
+			            $message_customer .= '<li>'.$langs->trans('Type').' : '.$object->type_label.'</li>';
267
+			            $message_customer .= '<li>'.$langs->trans('Category').' : '.$object->category_label.'</li>';
268
+			            $message_customer .= '<li>'.$langs->trans('Severity').' : '.$object->severity_label.'</li>';
269 269
 
270 270
 			            // Extrafields
271 271
 			            foreach ($this->attributes[$object->table_element]['label'] as $key => $value)
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 			            	if (empty($enabled)) $qualified = false;
286 286
 			            	if (empty($perms)) $qualified = false;
287 287
 
288
-			            	if ($qualified) $message_customer.='<li>'.$langs->trans($key).' : '.$value.'</li>';
288
+			            	if ($qualified) $message_customer .= '<li>'.$langs->trans($key).' : '.$value.'</li>';
289 289
 			            }
290 290
 
291
-			            $message_customer.='</ul>';
292
-			            $message_customer.='<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
293
-			            $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE?$conf->global->TICKET_URL_PUBLIC_INTERFACE.'/':dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
294
-			            $message_customer.='<p>' . $langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer') . ' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
295
-			            $message_customer.='<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
291
+			            $message_customer .= '</ul>';
292
+			            $message_customer .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
293
+			            $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
294
+			            $message_customer .= '<p>'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
295
+			            $message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
296 296
 
297 297
 			            $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
298 298
 			            $replyto = $from;
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 			            if ($mailfile->error) {
309 309
 	                        dol_syslog($mailfile->error, LOG_DEBUG);
310 310
 			            } else {
311
-			                      $result=$mailfile->sendfile();
311
+			                      $result = $mailfile->sendfile();
312 312
 			            }
313 313
 	                    if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
314 314
 	                        $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
@@ -319,19 +319,19 @@  discard block
 block discarded – undo
319 319
 	            break;
320 320
 
321 321
             case 'TICKET_DELETE':
322
-            	dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
322
+            	dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
323 323
             	break;
324 324
 
325 325
            	case 'TICKET_MODIFY':
326
-           		dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
326
+           		dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
327 327
            		break;
328 328
 
329 329
            	case 'TICKET_MARK_READ':
330
-           		dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
330
+           		dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
331 331
            		break;
332 332
 
333 333
            	case 'TICKET_CLOSE':
334
-           		dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
334
+           		dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
335 335
            		break;
336 336
     	}
337 337
 
Please login to merge, or discard this patch.
htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
58 58
 	{
59
-		if (empty($conf->blockedlog->enabled)) return 0;     // Module not active, we do nothing
59
+		if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing
60 60
 
61 61
 		// Test if event/record is qualified
62 62
 		$listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription', 'payment_various', 'cashcontrol');
63
-		if (! in_array($object->element, $listofqualifiedelement)) return 1;
63
+		if (!in_array($object->element, $listofqualifiedelement)) return 1;
64 64
 
65 65
 		dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
66 66
 
67 67
 		require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
68
-		$b=new BlockedLog($this->db);
68
+		$b = new BlockedLog($this->db);
69 69
 
70 70
 		// Tracked events
71
-		if (! in_array($action, array_keys($b->trackedevents)))
71
+		if (!in_array($action, array_keys($b->trackedevents)))
72 72
 		{
73 73
 			return 0;
74 74
 		}
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
 		// Event/record is qualified
77 77
 		$qualified = 0;
78 78
 		$amounts = 0;
79
-		if ($action==='BILL_VALIDATE' || $action==='BILL_DELETE' || $action === 'BILL_SENTBYMAIL'
80
-			|| $action==='BILL_SUPPLIER_VALIDATE' || $action==='BILL_SUPPLIER_DELETE' || $action === 'BILL_SUPPLIER_SENTBYMAIL'
81
-			|| $action==='MEMBER_SUBSCRIPTION_CREATE' || $action==='MEMBER_SUBSCRIPTION_MODIFY' || $action==='MEMBER_SUBSCRIPTION_DELETE'
82
-			|| $action==='DON_VALIDATE' || $action==='DON_MODIFY' || $action==='DON_DELETE'
83
-			|| $action==='CASHCONTROL_VALIDATE'
84
-			|| (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_DOWNLOAD') || (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_PREVIEW')
79
+		if ($action === 'BILL_VALIDATE' || $action === 'BILL_DELETE' || $action === 'BILL_SENTBYMAIL'
80
+			|| $action === 'BILL_SUPPLIER_VALIDATE' || $action === 'BILL_SUPPLIER_DELETE' || $action === 'BILL_SUPPLIER_SENTBYMAIL'
81
+			|| $action === 'MEMBER_SUBSCRIPTION_CREATE' || $action === 'MEMBER_SUBSCRIPTION_MODIFY' || $action === 'MEMBER_SUBSCRIPTION_DELETE'
82
+			|| $action === 'DON_VALIDATE' || $action === 'DON_MODIFY' || $action === 'DON_DELETE'
83
+			|| $action === 'CASHCONTROL_VALIDATE'
84
+			|| (in_array($object->element, array('facture', 'suplier_invoice')) && $action === 'DOC_DOWNLOAD') || (in_array($object->element, array('facture', 'suplier_invoice')) && $action === 'DOC_PREVIEW')
85 85
 		)
86 86
 		{
87 87
 			$qualified++;
88 88
 
89 89
 			if (in_array($action, array(
90
-				'MEMBER_SUBSCRIPTION_CREATE','MEMBER_SUBSCRIPTION_MODIFY','MEMBER_SUBSCRIPTION_DELETE',
91
-				'DON_VALIDATE','DON_MODIFY','DON_DELETE'))) $amounts = (double) $object->amount;
90
+				'MEMBER_SUBSCRIPTION_CREATE', 'MEMBER_SUBSCRIPTION_MODIFY', 'MEMBER_SUBSCRIPTION_DELETE',
91
+				'DON_VALIDATE', 'DON_MODIFY', 'DON_DELETE'))) $amounts = (double) $object->amount;
92 92
 			elseif ($action == 'CASHCONTROL_VALIDATE')
93 93
 			{
94 94
 				$amounts = (double) $object->cash + (double) $object->cheque + (double) $object->card;
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 		{
107 107
 			$qualified++;
108 108
 			$amounts = 0;
109
-			if(!empty($object->amounts)) {
110
-				foreach($object->amounts as $amount) {
109
+			if (!empty($object->amounts)) {
110
+				foreach ($object->amounts as $amount) {
111 111
 					$amounts += price2num($amount);
112 112
 				}
113 113
 			}
114 114
 		}
115
-		elseif (strpos($action,'PAYMENT')!==false && ! in_array($action, array('PAYMENT_ADD_TO_BANK')))
115
+		elseif (strpos($action, 'PAYMENT') !== false && !in_array($action, array('PAYMENT_ADD_TO_BANK')))
116 116
 		{
117 117
 			$qualified++;
118 118
 			$amounts = (double) $object->amount;
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 
121 121
 		// Another protection.
122 122
 		// May be used when event is DOC_DOWNLOAD or DOC_PREVIEW and element is not an invoice
123
-		if (! $qualified)
123
+		if (!$qualified)
124 124
 		{
125 125
 			return 0; // not implemented action log
126 126
 		}
127 127
 
128
-		$result = $b->setObjectData($object, $action, $amounts, $user);		// Set field date_object, ref_object, fk_object, element, object_data
128
+		$result = $b->setObjectData($object, $action, $amounts, $user); // Set field date_object, ref_object, fk_object, element, object_data
129 129
 
130 130
 		if ($result < 0)
131 131
 		{
Please login to merge, or discard this patch.
dolibarr/htdocs/core/db/Database.interface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -419,7 +419,7 @@
 block discarded – undo
419 419
 	 * @param	bool			$gm			1=Input informations are GMT values, otherwise local to server TZ
420 420
 	 * @return	int|string					Date TMS or ''
421 421
 	 */
422
-	function jdate($string, $gm=false);
422
+	function jdate($string, $gm = false);
423 423
 
424 424
 	/**
425 425
 	 * Encrypt sensitive data in database
Please login to merge, or discard this patch.