diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index cb80f49e790..e33ec6b3d55 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015-2017 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -305,16 +305,17 @@ if ($id) dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', ''); + + print '
'; + print '
'; print ''; - print ""; - print ''; - // Label - print ''; + print ''; print ""; print ''; - print ''; + print ''; + print ''; print ''; - print ''; + print ''; + print ''; } } - // Other attributes - $reshook=$hookmanager->executeHooks('formObjectOptions','',$object,$action); // Note that $action and $object may have been modified by hook + // Other attributes + $reshook=$hookmanager->executeHooks('formObjectOptions','',$object,$action); // Note that $action and $object may have been modified by hook print '
'.$langs->trans("Ref").''; - print $object->ref; - print '
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("DatePayment").''; @@ -335,23 +336,25 @@ if ($id) { if ($object->fk_account > 0) { - $bankline=new AccountLine($db); - $bankline->fetch($object->fk_bank); + $bankline=new AccountLine($db); + $bankline->fetch($object->fk_bank); - print '
'.$langs->trans('BankTransactionLine').'
'.$langs->trans('BankTransactionLine').''; print $bankline->getNomUrl(1,0,'showall'); - print '
'; + print '
'; + dol_fiche_end(); /* diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 5cf8b6566bd..045284bd47c 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur - * Copyright (C) 2011-2015 Alexandre Spangaro + * Copyright (C) 2011-2017 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,6 +34,7 @@ class Tva extends CommonObject { //public $element='tva'; //!< Id that identify managed objects //public $table_element='tva'; //!< Name of table without prefix where object is stored + public $picto='payment'; var $tms; var $datep; @@ -73,6 +74,7 @@ class Tva extends CommonObject global $conf, $langs; $error=0; + $now=dol_now(); // Clean parameters $this->amount=trim($this->amount); @@ -89,7 +91,7 @@ class Tva extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva("; - $sql.= "tms,"; + $sql.= "datec,"; $sql.= "datep,"; $sql.= "datev,"; $sql.= "amount,"; @@ -101,7 +103,7 @@ class Tva extends CommonObject $sql.= ") VALUES ("; - $sql.= " '".$this->db->idate($this->tms)."',"; + $sql.= " '".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($this->datep)."',"; $sql.= " '".$this->db->idate($this->datev)."',"; $sql.= " '".$this->amount."',"; @@ -677,46 +679,70 @@ class Tva extends CommonObject * @param int $id Id of vat payment * @return int <0 if KO, >0 if OK */ - function info($id) - { - $sql = "SELECT t.rowid, t.tms as datec, t.fk_user_creat"; - $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; - $sql.= " WHERE t.rowid = ".$id; + function info($id) + { + $sql = "SELECT t.rowid, t.tms, t.datec, t.fk_user_creat"; + $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; + $sql.= " WHERE t.rowid = ".$id; - dol_syslog(get_class($this)."::info", LOG_DEBUG); - $result=$this->db->query($sql); - if ($result) - { - if ($this->db->num_rows($result)) - { - $obj = $this->db->fetch_object($result); + dol_syslog(get_class($this)."::info", LOG_DEBUG); + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); - $this->id = $obj->rowid; + $this->id = $obj->rowid; - if ($obj->fk_user_creat) { - $cuser = new User($this->db); - $cuser->fetch($obj->fk_user_creat); - $this->user_creation = $cuser; - } + if ($obj->fk_user_creat) { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_creat); + $this->user_creation = $cuser; + } - if ($obj->fk_user_modif) { - $muser = new User($this->db); - $muser->fetch($obj->fk_user_modif); - $this->user_modification = $muser; - } + if ($obj->fk_user_modif) { + $muser = new User($this->db); + $muser->fetch($obj->fk_user_modif); + $this->user_modification = $muser; + } - $this->date_creation = $this->db->jdate($obj->datec); - $this->date_modification = $this->db->jdate($obj->datec); - $this->import_key = $obj->import_key; - } + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->tms); + $this->import_key = $obj->import_key; + } - $this->db->free($result); + $this->db->free($result); - } - else - { - dol_print_error($this->db); - } - } + } + else + { + dol_print_error($this->db); + } + } + /** + * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Libelle + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->statut,$mode); + } + + /** + * Renvoi le libelle d'un statut donne + * + * @param int $status Statut + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Libelle du statut + */ + function LibStatut($status,$mode=0) + { + global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage + + return ''; + } } diff --git a/htdocs/compta/tva/info.php b/htdocs/compta/tva/info.php index 0c6ce29475a..fb932f0f983 100644 --- a/htdocs/compta/tva/info.php +++ b/htdocs/compta/tva/info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2017 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,12 +53,21 @@ $head = vat_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("VATPayment"), 0, 'payment'); +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', ''); + +print '
'; +print '
'; + print '
'; dol_print_object_info($object); print '
'; print '
'; +dol_fiche_end(); + llxFooter(); $db->close(); diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index d7e68346511..8fd64aa596e 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -379,3 +379,4 @@ create table llx_loan_schedule fk_user_modif integer )ENGINE=innodb; +ALTER TABLE llx_tva ADD COLUMN datec date AFTER tms; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_tva.sql b/htdocs/install/mysql/tables/llx_tva.sql index f33280ff511..9abf63d6ad9 100644 --- a/htdocs/install/mysql/tables/llx_tva.sql +++ b/htdocs/install/mysql/tables/llx_tva.sql @@ -21,6 +21,7 @@ create table llx_tva ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, + datec datetime, -- Create date datep date, -- date de paiement datev date, -- date de valeur amount real NOT NULL DEFAULT 0,