55 |
var $adresse_proprio; |
var $adresse_proprio; |
56 |
var $type_lib=array(); |
var $type_lib=array(); |
57 |
|
|
58 |
|
/** |
59 |
|
* Constructeur |
60 |
|
*/ |
61 |
function Account($DB, $rowid=0) |
function Account($DB, $rowid=0) |
62 |
{ |
{ |
63 |
global $langs; |
global $langs; |
329 |
} |
} |
330 |
|
|
331 |
/* |
/* |
332 |
* \brief Charge en memoire depuis la base le compte |
* \brief Charge en memoire depuis la base le compte |
333 |
|
* \param id Id du compte à récupérer |
334 |
*/ |
*/ |
335 |
function fetch($id) |
function fetch($id) |
336 |
{ |
{ |
534 |
|
|
535 |
} |
} |
536 |
|
|
537 |
|
|
538 |
|
class AccountLine |
539 |
|
{ |
540 |
|
var $db; |
541 |
|
|
542 |
|
/** |
543 |
|
* Constructeur |
544 |
|
*/ |
545 |
|
function AccountLine($DB, $rowid=0) |
546 |
|
{ |
547 |
|
global $langs; |
548 |
|
|
549 |
|
$this->db = $DB; |
550 |
|
$this->rowid = $rowid; |
551 |
|
|
552 |
|
return 1; |
553 |
|
} |
554 |
|
|
555 |
|
/** |
556 |
|
* \brief Charge en memoire depuis la base, une ecriture sur le compte |
557 |
|
* \param id Id de la ligne écriture à récupérer |
558 |
|
*/ |
559 |
|
function fetch($rowid) |
560 |
|
{ |
561 |
|
$sql = "SELECT datec, datev, dateo, amount, label, fk_user_author, fk_user_rappro,"; |
562 |
|
$sql.= " fk_type, num_releve, num_chq, rappro, note"; |
563 |
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank"; |
564 |
|
$sql.= " WHERE rowid = ".$rowid; |
565 |
|
|
566 |
|
$result = $this->db->query($sql); |
567 |
|
if ($result) |
568 |
|
{ |
569 |
|
if ($this->db->num_rows($result)) |
570 |
|
{ |
571 |
|
$obj = $this->db->fetch_object($result); |
572 |
|
|
573 |
|
$this->rowid = $rowid; |
574 |
|
$this->ref = $rowid; |
575 |
|
|
576 |
|
$this->datec = $obj->datec; |
577 |
|
$this->datev = $obj->datev; |
578 |
|
$this->dateo = $obj->dateo; |
579 |
|
$this->amount = $obj->amount; |
580 |
|
$this->label = $obj->label; |
581 |
|
$this->note = $obj->note; |
582 |
|
|
583 |
|
$this->fk_user_author = $obj->fk_user_author; |
584 |
|
$this->fk_user_rappro = $obj->fk_user_rappro; |
585 |
|
|
586 |
|
$this->fk_type = $obj->fk_type; |
587 |
|
$this->num_releve = $obj->num_releve; |
588 |
|
$this->num_chq = $obj->num_chq; |
589 |
|
|
590 |
|
$this->rappro = $obj->rappro; |
591 |
|
} |
592 |
|
$this->db->free($result); |
593 |
|
} |
594 |
|
else |
595 |
|
{ |
596 |
|
dolibarr_print_error($this->db); |
597 |
|
} |
598 |
|
} |
599 |
|
|
600 |
|
|
601 |
|
/** |
602 |
|
* \brief Charge les informations d'ordre info dans l'objet facture |
603 |
|
* \param id Id de la facture a charger |
604 |
|
*/ |
605 |
|
function info($rowid) |
606 |
|
{ |
607 |
|
$sql = 'SELECT b.rowid, '.$this->db->pdate('datec').' as datec,'; |
608 |
|
$sql.= ' fk_user_author, fk_user_rappro'; |
609 |
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'bank as b'; |
610 |
|
$sql.= ' WHERE b.rowid = '.$rowid; |
611 |
|
|
612 |
|
$result=$this->db->query($sql); |
613 |
|
if ($result) |
614 |
|
{ |
615 |
|
if ($this->db->num_rows($result)) |
616 |
|
{ |
617 |
|
$obj = $this->db->fetch_object($result); |
618 |
|
$this->id = $obj->rowid; |
619 |
|
|
620 |
|
if ($obj->fk_user_author) |
621 |
|
{ |
622 |
|
$cuser = new User($this->db, $obj->fk_user_author); |
623 |
|
$cuser->fetch(); |
624 |
|
$this->user_creation = $cuser; |
625 |
|
} |
626 |
|
if ($obj->fk_user_rappro) |
627 |
|
{ |
628 |
|
$ruser = new User($this->db, $obj->fk_user_rappro); |
629 |
|
$ruser->fetch(); |
630 |
|
$this->user_rappro = $ruser; |
631 |
|
} |
632 |
|
|
633 |
|
$this->date_creation = $obj->datec; |
634 |
|
//$this->date_rappro = $obj->daterappro; // \todo pas encore gérée |
635 |
|
} |
636 |
|
$this->db->free($result); |
637 |
|
} |
638 |
|
else |
639 |
|
{ |
640 |
|
dolibarr_print_error($this->db); |
641 |
|
} |
642 |
|
} |
643 |
|
|
644 |
|
} |
645 |
|
|
646 |
?> |
?> |