Skip to content

Commit

Permalink
Fix creation date was not filled
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 16, 2018
1 parent 26ba0a9 commit a84ed84
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions htdocs/compta/tva/card.php
Expand Up @@ -82,13 +82,13 @@
$object->datev=$datev;
$object->datep=$datep;

$amount = price2num(GETPOST("amount"));
$amount = price2num(GETPOST("amount",'alpha'));
if ($refund == 1) {
$amount= -$amount;
}
$object->amount= $amount;
$object->label=GETPOST("label");
$object->note=GETPOST("note");
$object->label=GETPOST("label",'alpha');
$object->note=GETPOST("note",'none');

if (empty($object->datev))
{
Expand Down Expand Up @@ -304,7 +304,7 @@
{
$head=vat_prepare_head($object);

dol_fiche_head($head, 'card', $langs->trans("VATPayment"), 0, 'payment');
dol_fiche_head($head, 'card', $langs->trans("VATPayment"), -1, 'payment');

$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/reglement.php">'.$langs->trans("BackToList").'</a>';

Expand Down
15 changes: 8 additions & 7 deletions htdocs/compta/tva/class/tva.class.php
Expand Up @@ -100,9 +100,7 @@ function create($user)
$sql.= "fk_bank,";
$sql.= "fk_user_creat,";
$sql.= "fk_user_modif";

$sql.= ") VALUES (";

$sql.= " '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->datep)."',";
$sql.= " '".$this->db->idate($this->datev)."',";
Expand All @@ -112,7 +110,6 @@ function create($user)
$sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->db->escape($this->fk_bank)."'").",";
$sql.= " '".$this->db->escape($this->fk_user_creat)."',";
$sql.= " '".$this->db->escape($this->fk_user_modif)."'";

$sql.= ")";

dol_syslog(get_class($this)."::create", LOG_DEBUG);
Expand Down Expand Up @@ -496,6 +493,7 @@ function addPayment($user)
$this->fk_bank=trim($this->fk_bank);
$this->fk_user_creat=trim($this->fk_user_creat);
$this->fk_user_modif=trim($this->fk_user_modif);
if (empty($this->datec)) $this->datec = dol_now();

// Check parameters
if (! $this->label)
Expand All @@ -520,8 +518,10 @@ function addPayment($user)
}

// Insert into llx_tva
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva (datep";
$sql.= ", datev";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva (";
$sql.= "datec";
$sql.= ", datep";
$sql.= ", datev";
$sql.= ", amount";
$sql.= ", fk_typepayment";
$sql.= ", num_payment";
Expand All @@ -532,7 +532,8 @@ function addPayment($user)
$sql.= ", entity";
$sql.= ") ";
$sql.= " VALUES (";
$sql.= "'".$this->db->idate($this->datep)."'";
$sql.= " '".$this->db->idate($this->datec)."'";
$sql.= ", '".$this->db->idate($this->datep)."'";
$sql.= ", '".$this->db->idate($this->datev)."'";
$sql.= ", ".$this->amount;
$sql.= ", '".$this->db->escape($this->type_payment)."'";
Expand Down Expand Up @@ -678,7 +679,7 @@ function getNomUrl($withpicto=0,$option='')
*/
function info($id)
{
$sql = "SELECT t.rowid, t.tms, t.datec, t.fk_user_creat";
$sql = "SELECT t.rowid, t.tms, t.fk_user_modif, t.datec, t.fk_user_creat";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
$sql.= " WHERE t.rowid = ".$id;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/tva/info.php
Expand Up @@ -51,7 +51,7 @@

$head = vat_prepare_head($object);

dol_fiche_head($head, 'info', $langs->trans("VATPayment"), 0, 'payment');
dol_fiche_head($head, 'info', $langs->trans("VATPayment"), -1, 'payment');

$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/reglement.php">'.$langs->trans("BackToList").'</a>';

Expand Down
1 change: 1 addition & 0 deletions htdocs/install/mysql/migration/6.0.0-7.0.0.sql
Expand Up @@ -595,6 +595,7 @@ ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_fk_user (f

ALTER TABLE llx_actioncomm_reminder ADD UNIQUE INDEX uk_actioncomm_reminder_unique(fk_user, typeremind, offsetvalue, offsetunit);

UPDATE llx_tva SET datec = tms where datec IS NULL;

-- VPGSQL8.2 CREATE SEQUENCE llx_supplier_proposal_rowid_seq;
-- VPGSQL8.2 ALTER TABLE llx_supplier_proposal ALTER COLUMN rowid SET DEFAULT nextval('llx_supplier_proposal_rowid_seq');
Expand Down

0 comments on commit a84ed84

Please sign in to comment.