Completed
Branch develop (e6f0e7)
by
unknown
24:49
created

PaymentVarious   C

Complexity

Total Complexity 79

Size/Duplication

Total Lines 556
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 556
rs 5.442
c 0
b 0
f 0
wmc 79
lcom 2
cbo 4

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
B update() 0 63 6
A fetch() 0 66 3
B delete() 0 25 3
A initAsSpecimen() 0 16 1
F create() 0 161 24
A update_fk_bank() 0 15 2
A getLibStatut() 0 4 1
D LibStatut() 0 37 28
B getNomUrl() 0 17 5
B info() 0 37 5

How to fix   Complexity   

Complex Class

Complex classes like PaymentVarious often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use PaymentVarious, and based on these observations, apply Extract Interface, too.

1
<?php
2
/* Copyright (C) 2017		Alexandre Spangaro   <[email protected]>
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
 */
17
18
/**
19
 *  \file		htdocs/compta/bank/class/paymentvarious.class.php
20
 *  \ingroup	bank
21
 *  \brief		Class for various payment
22
 */
23
24
// Put here all includes required by your class file
25
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
26
27
28
/**
29
 *  Class to manage various payments
30
 */
31
class PaymentVarious extends CommonObject
32
{
33
	public $element='variouspayment';		//!< Id that identify managed objects
34
	public $table_element='payment_various';	//!< Name of table without prefix where object is stored
35
	public $picto = 'bill';
36
37
	var $tms;
38
	var $datep;
39
	var $datev;
40
	var $sens;
41
	var $amount;
42
	var $type_payment;
43
	var $num_payment;
44
	var $label;
45
	var $accountancy_code;
46
	var $fk_project;
47
	var $fk_bank;
48
	var $fk_user_author;
49
	var $fk_user_modif;
50
51
52
	/**
53
	 *	Constructor
54
	 *
55
	 *  @param		DoliDB		$db      Database handler
56
	 */
57
	function __construct($db)
58
	{
59
		$this->db = $db;
60
		$this->element = 'payment_various';
61
		$this->table_element = 'payment_various';
62
		return 1;
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
63
	}
64
65
	/**
66
	 * Update database
67
	 *
68
	 * @param   User	$user        	User that modify
69
	 * @param	int		$notrigger	    0=no, 1=yes (no update trigger)
70
	 * @return  int         			<0 if KO, >0 if OK
71
	 */
72
	function update($user=null, $notrigger=0)
73
	{
74
		global $conf, $langs;
75
76
		$error=0;
77
78
		// Clean parameters
79
		$this->amount=trim($this->amount);
80
		$this->label=trim($this->label);
81
		$this->note=trim($this->note);
82
		$this->fk_bank=trim($this->fk_bank);
83
		$this->fk_user_author=trim($this->fk_user_author);
84
		$this->fk_user_modif=trim($this->fk_user_modif);
85
86
		$this->db->begin();
87
88
		// Update request
89
		$sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
90
91
		$sql.= " tms='".$this->db->idate($this->tms)."',";
92
		$sql.= " datep='".$this->db->idate($this->datep)."',";
93
		$sql.= " datev='".$this->db->idate($this->datev)."',";
94
		$sql.= " sens=".$this->sens.",";
95
		$sql.= " amount=".price2num($this->amount).",";
96
		$sql.= " fk_typepayment=".$this->fk_typepayment."',";
97
		$sql.= " num_payment='".$this->db->escape($this->num_payment)."',";
98
		$sql.= " label='".$this->db->escape($this->label)."',";
99
		$sql.= " note='".$this->db->escape($this->note)."',";
100
		$sql.= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
101
		$sql.= " fk_projet='".$this->db->escape($this->fk_project)."',";
102
		$sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").",";
103
		$sql.= " fk_user_author=".$this->fk_user_author.",";
104
		$sql.= " fk_user_modif=".$this->fk_user_modif;
105
106
		$sql.= " WHERE rowid=".$this->id;
107
108
		dol_syslog(get_class($this)."::update", LOG_DEBUG);
109
		$resql = $this->db->query($sql);
110
		if (! $resql)
111
		{
112
			$this->error="Error ".$this->db->lasterror();
113
			return -1;
114
		}
115
116
		if (! $notrigger)
117
		{
118
			// Call trigger
119
			$result=$this->call_trigger('PAYMENT_VARIOUS_MODIFY',$user);
0 ignored issues
show
Bug introduced by
It seems like $user defined by parameter $user on line 72 can be null; however, CommonObject::call_trigger() does not accept null, maybe add an additional type check?

It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.

We recommend to add an additional type check (or disallow null for the parameter):

function notNullable(stdClass $x) { }

// Unsafe
function withoutCheck(stdClass $x = null) {
    notNullable($x);
}

// Safe - Alternative 1: Adding Additional Type-Check
function withCheck(stdClass $x = null) {
    if ($x instanceof stdClass) {
        notNullable($x);
    }
}

// Safe - Alternative 2: Changing Parameter
function withNonNullableParam(stdClass $x) {
    notNullable($x);
}
Loading history...
120
			if ($result < 0) $error++;
121
			// End call triggers
122
		}
123
124
		if (! $error)
125
		{
126
			$this->db->commit();
127
			return 1;
128
		}
129
		else
130
		{
131
			$this->db->rollback();
132
			return -1;
133
		}
134
	}
135
136
137
	/**
138
	 *  Load object in memory from database
139
	 *
140
	 *  @param	int		$id         id object
141
	 *  @param  User	$user       User that load
142
	 *  @return int         		<0 if KO, >0 if OK
143
	 */
144
	function fetch($id, $user=null)
145
	{
146
		global $langs;
147
		$sql = "SELECT";
148
		$sql.= " v.rowid,";
149
150
		$sql.= " v.tms,";
151
		$sql.= " v.datep,";
152
		$sql.= " v.datev,";
153
		$sql.= " v.sens,";
154
		$sql.= " v.amount,";
155
		$sql.= " v.fk_typepayment,";
156
		$sql.= " v.num_payment,";
157
		$sql.= " v.label,";
158
		$sql.= " v.note,";
159
		$sql.= " v.accountancy_code,";
160
		$sql.= " v.fk_projet as fk_project,";
161
		$sql.= " v.fk_bank,";
162
		$sql.= " v.fk_user_author,";
163
		$sql.= " v.fk_user_modif,";
164
		$sql.= " b.fk_account,";
165
		$sql.= " b.fk_type,";
166
		$sql.= " b.rappro";
167
168
		$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
169
		$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
170
		$sql.= " WHERE v.rowid = ".$id;
171
172
		dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
173
		$resql=$this->db->query($sql);
174
		if ($resql)
175
		{
176
			if ($this->db->num_rows($resql))
177
			{
178
				$obj = $this->db->fetch_object($resql);
179
180
				$this->id				= $obj->rowid;
181
				$this->ref				= $obj->rowid;
182
				$this->tms				= $this->db->jdate($obj->tms);
183
				$this->datep			= $this->db->jdate($obj->datep);
184
				$this->datev			= $this->db->jdate($obj->datev);
185
				$this->sens				= $obj->sens;
186
				$this->amount			= $obj->amount;
187
				$this->type_payement	= $obj->fk_typepayment;
188
				$this->num_payment		= $obj->num_payment;
189
				$this->label			= $obj->label;
190
				$this->note				= $obj->note;
191
				$this->accountancy_code	= $obj->accountancy_code;
192
				$this->fk_project		= $obj->fk_project;
193
				$this->fk_bank			= $obj->fk_bank;
194
				$this->fk_user_author	= $obj->fk_user_author;
195
				$this->fk_user_modif	= $obj->fk_user_modif;
196
				$this->fk_account		= $obj->fk_account;
197
				$this->fk_type			= $obj->fk_type;
198
				$this->rappro			= $obj->rappro;
199
			}
200
			$this->db->free($resql);
201
202
			return 1;
203
		}
204
		else
205
		{
206
			$this->error="Error ".$this->db->lasterror();
207
			return -1;
208
		}
209
	}
210
211
212
	/**
213
	 *  Delete object in database
214
	 *
215
	 *	@param	User	$user       User that delete
216
	 *	@return	int					<0 if KO, >0 if OK
217
	 */
218
	function delete($user)
219
	{
220
		global $conf, $langs;
221
222
		$error=0;
223
224
		// Call trigger
225
		$result=$this->call_trigger('PAYMENT_VARIOUS_DELETE',$user);
226
		if ($result < 0) return -1;
227
		// End call triggers
228
229
230
		$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_various";
231
		$sql.= " WHERE rowid=".$this->id;
232
233
		dol_syslog(get_class($this)."::delete", LOG_DEBUG);
234
		$resql = $this->db->query($sql);
235
		if (! $resql)
236
		{
237
			$this->error="Error ".$this->db->lasterror();
238
			return -1;
239
		}
240
241
		return 1;
242
	}
243
244
245
	/**
246
	 *  Initialise an instance with random values.
247
	 *  Used to build previews or test instances.
248
	 *	id must be 0 if object instance is a specimen.
249
	 *
250
	 *  @return	void
251
	 */
252
	function initAsSpecimen()
253
	{
254
		$this->id=0;
255
256
		$this->tms='';
257
		$this->datep='';
258
		$this->datev='';
259
		$this->sens='';
260
		$this->amount='';
261
		$this->label='';
262
		$this->accountancy_code='';
263
		$this->note='';
264
		$this->fk_bank='';
265
		$this->fk_user_author='';
266
		$this->fk_user_modif='';
267
	}
268
269
    /**
270
     *  Create in database
271
     *
272
     *  @param      User	$user       User that create
273
     *  @return     int      			<0 if KO, >0 if OK
274
     */
275
	function create($user)
276
	{
277
		global $conf,$langs;
278
279
		$error=0;
280
		$now=dol_now();
281
282
		// Clean parameters
283
		$this->amount=price2num(trim($this->amount));
284
		$this->label=trim($this->label);
285
		$this->note=trim($this->note);
286
		$this->fk_bank=trim($this->fk_bank);
287
		$this->fk_user_author=trim($this->fk_user_author);
288
		$this->fk_user_modif=trim($this->fk_user_modif);
289
290
		// Check parameters
291
		if (! $this->label)
292
		{
293
			$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
294
			return -3;
295
		}
296
		if ($this->amount < 0 || $this->amount == '')
297
		{
298
			$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
299
			return -5;
300
		}
301
		if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0))
302
		{
303
			$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account"));
304
			return -6;
305
		}
306
		if (! empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
307
		{
308
			$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
309
			return -7;
310
		}
311
312
		$this->db->begin();
313
314
		// Insert into llx_payment_various
315
		$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_various (";
316
		$sql.= " datep";
317
		$sql.= ", datev";
318
		$sql.= ", sens";
319
		$sql.= ", amount";
320
		$sql.= ", fk_typepayment";
321
		$sql.= ", num_payment";
322
		if ($this->note) $sql.= ", note";
323
		$sql.= ", label";
324
		$sql.= ", accountancy_code";
325
		$sql.= ", fk_projet";
326
		$sql.= ", fk_user_author";
327
		$sql.= ", datec";
328
		$sql.= ", fk_bank";
329
		$sql.= ", entity";
330
		$sql.= ")";
331
		$sql.= " VALUES (";
332
		$sql.= "'".$this->db->idate($this->datep)."'";
333
		$sql.= ", '".$this->db->idate($this->datev)."'";
334
		$sql.= ", '".$this->db->escape($this->sens)."'";
335
		$sql.= ", ".$this->amount;
336
		$sql.= ", '".$this->db->escape($this->type_payment)."'";
337
		$sql.= ", '".$this->db->escape($this->num_payment)."'";
338
		if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
339
		$sql.= ", '".$this->db->escape($this->label)."'";
340
		$sql.= ", '".$this->db->escape($this->accountancy_code)."'";
341
		$sql.= ", ".$user->id;
342
		$sql.= ", '".$this->db->idate($now)."'";
343
		$sql.= ", NULL";
344
		$sql.= ", ".$conf->entity;
345
		$sql.= ")";
346
347
		dol_syslog(get_class($this)."::create", LOG_DEBUG);
348
		$result = $this->db->query($sql);
349
		if ($result)
350
		{
351
			$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various");
352
353
			if ($this->id > 0)
354
			{
355
				if (! empty($conf->banque->enabled) && ! empty($this->amount))
356
				{
357
					// Insert into llx_bank
358
					require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
359
360
					$acc = new Account($this->db);
361
					$result=$acc->fetch($this->accountid);
362
					if ($result <= 0) dol_print_error($this->db);
363
364
					// Insert payment into llx_bank
365
					// Add link 'payment_various' in bank_url between payment and bank transaction
366
					if ($this->sens == '0') $sign='-';
367
368
					$bank_line_id = $acc->addline(
369
						$this->datep,
370
						$this->type_payment,
371
						$this->label,
372
						$sign.abs($this->amount),
0 ignored issues
show
Bug introduced by
The variable $sign does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
373
						$this->num_payment,
374
						'',
375
						$user
376
					);
377
378
					// Update fk_bank into llx_paiement.
379
					// So we know the payment which has generate the banking ecriture
380
					if ($bank_line_id > 0)
381
					{
382
						$this->update_fk_bank($bank_line_id);
383
					}
384
					else
385
					{
386
						$this->error=$acc->error;
387
						$error++;
388
					}
389
390
					if (! $error)
391
					{
392
						// Add link 'payment_various' in bank_url between payment and bank transaction
393
						$url=DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id=';
394
395
						$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(VariousPayment)", "payment_various");
396
						if ($result <= 0)
397
						{
398
							$this->error=$acc->error;
399
							$error++;
400
						}
401
					}
402
403
					if ($result <= 0)
404
					{
405
						$this->error=$acc->error;
406
						$error++;
407
					}
408
				}
409
410
	            // Call trigger
411
	            $result=$this->call_trigger('PAYMENT_VARIOUS_CREATE',$user);
412
	            if ($result < 0) $error++;
413
	            // End call triggers
414
415
			}
416
			else $error++;
417
418
			if (! $error)
419
			{
420
				$this->db->commit();
421
				return $this->id;
422
			}
423
			else
424
			{
425
				$this->db->rollback();
426
				return -2;
427
			}
428
		}
429
		else
430
		{
431
			$this->error=$this->db->error();
432
			$this->db->rollback();
433
			return -1;
434
		}
435
	}
436
437
	/**
438
	 *  Update link between payment various and line generate into llx_bank
439
	 *
440
	 *  @param	int		$id_bank    Id bank account
441
	 *	@return	int					<0 if KO, >0 if OK
442
	 */
443
	function update_fk_bank($id_bank)
444
	{
445
		$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.$id_bank;
446
		$sql.= ' WHERE rowid = '.$this->id;
447
		$result = $this->db->query($sql);
448
		if ($result)
449
		{
450
			return 1;
451
		}
452
		else
453
		{
454
			dol_print_error($this->db);
455
			return -1;
456
		}
457
	}
458
459
460
	/**
461
	 * Retourne le libelle du statut
462
	 *
463
	 * @param	int		$mode   	0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
464
	 * @return  string   		   	Libelle
465
	 */
466
	function getLibStatut($mode=0)
467
	{
468
		return $this->LibStatut($this->statut,$mode);
469
	}
470
471
	/**
472
	 *  Renvoi le libelle d'un statut donne
473
	 *
474
	 *  @param	int		$statut     Id status
475
	 *  @param  int		$mode       0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
476
	 *  @return string      		Libelle
477
	 */
478
	function LibStatut($statut,$mode=0)
479
	{
480
		global $langs;
481
482
		if ($mode == 0)
483
		{
484
			return $langs->trans($this->statuts[$statut]);
485
		}
486
		if ($mode == 1)
487
		{
488
			return $langs->trans($this->statuts_short[$statut]);
489
		}
490
		if ($mode == 2)
491
		{
492
			if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
493
			if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
494
			if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
495
		}
496
		if ($mode == 3)
497
		{
498
			if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
499
			if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
500
			if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
501
		}
502
		if ($mode == 4)
503
		{
504
			if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
505
			if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
506
			if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
507
		}
508
		if ($mode == 5)
509
		{
510
			if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
511
			if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
512
			if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
513
		}
514
	}
515
516
517
	/**
518
	 *	Send name clicable (with possibly the picto)
519
	 *
520
	 *	@param	int		$withpicto		0=No picto, 1=Include picto into link, 2=Only picto
521
	 *	@param	string	$option			link option
522
	 *	@return	string					Chaine with URL
523
	 */
524
	function getNomUrl($withpicto=0,$option='')
525
	{
526
		global $langs;
527
528
		$result='';
529
        $label=$langs->trans("ShowVariousPayment").': '.$this->ref;
530
531
        $link = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
532
		$linkend='</a>';
533
534
		$picto='payment';
535
536
        if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
537
		if ($withpicto && $withpicto != 2) $result.=' ';
538
		if ($withpicto != 2) $result.=$link.$this->ref.$linkend;
539
		return $result;
540
	}
541
542
	/**
543
	 * Information on record
544
	 *
545
	 * @param	int		$id      Id of record
546
	 * @return	void
547
	 */
548
	function info($id)
549
	{
550
		$sql = 'SELECT v.rowid, v.datec, v.fk_user_author';
551
		$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
552
		$sql.= ' WHERE v.rowid = '.$id;
553
554
		dol_syslog(get_class($this).'::info', LOG_DEBUG);
555
		$result = $this->db->query($sql);
556
557
		if ($result)
558
		{
559
			if ($this->db->num_rows($result))
560
			{
561
				$obj = $this->db->fetch_object($result);
562
				$this->id = $obj->rowid;
563
				if ($obj->fk_user_author)
564
				{
565
					$cuser = new User($this->db);
566
					$cuser->fetch($obj->fk_user_author);
567
					$this->user_creation = $cuser;
568
				}
569
				$this->date_creation = $this->db->jdate($obj->datec);
570
				if ($obj->fk_user_modif)
571
				{
572
					$muser = new User($this->db);
573
					$muser->fetch($obj->fk_user_modif);
574
					$this->user_modif = $muser;
575
				}
576
				$this->date_modif = $this->db->jdate($obj->tms);
577
			}
578
			$this->db->free($result);
579
		}
580
		else
581
		{
582
			dol_print_error($this->db);
583
		}
584
	}
585
586
}
587