Salaries : Add info card / add field datec / rename field user_creat to user_author
This commit is contained in:
parent
74e46b2de3
commit
918c323f8f
@ -83,7 +83,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$object->note=GETPOST("note");
|
||||
$object->type_payment=GETPOST("paymenttype");
|
||||
$object->num_payment=GETPOST("num_payment");
|
||||
$object->fk_user_creat=$user->id;
|
||||
$object->fk_user_author=$user->id;
|
||||
|
||||
// Set user current salary as ref salaray for the payment
|
||||
$fuser=new User($db);
|
||||
@ -315,7 +315,6 @@ if ($id)
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("SalaryPayment"), 0, 'payment');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr>";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -49,7 +49,7 @@ class PaymentSalary extends CommonObject
|
||||
var $dateep;
|
||||
var $note;
|
||||
var $fk_bank;
|
||||
var $fk_user_creat;
|
||||
var $fk_user_author;
|
||||
var $fk_user_modif;
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ class PaymentSalary extends CommonObject
|
||||
$this->label=trim($this->label);
|
||||
$this->note=trim($this->note);
|
||||
$this->fk_bank=trim($this->fk_bank);
|
||||
$this->fk_user_creat=trim($this->fk_user_creat);
|
||||
$this->fk_user_author=trim($this->fk_user_author);
|
||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||
|
||||
// Check parameters
|
||||
@ -112,7 +112,7 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= " dateep=".$this->db->idate($this->dateep).",";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").",";
|
||||
$sql.= " fk_user_creat='".$this->fk_user_creat."',";
|
||||
$sql.= " fk_user_author='".$this->fk_user_author."',";
|
||||
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
@ -171,7 +171,7 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= " s.dateep,";
|
||||
$sql.= " s.note,";
|
||||
$sql.= " s.fk_bank,";
|
||||
$sql.= " s.fk_user_creat,";
|
||||
$sql.= " s.fk_user_author,";
|
||||
$sql.= " s.fk_user_modif,";
|
||||
$sql.= " b.fk_account,";
|
||||
$sql.= " b.fk_type,";
|
||||
@ -203,7 +203,7 @@ class PaymentSalary extends CommonObject
|
||||
$this->dateep = $this->db->jdate($obj->dateep);
|
||||
$this->note = $obj->note;
|
||||
$this->fk_bank = $obj->fk_bank;
|
||||
$this->fk_user_creat = $obj->fk_user_creat;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->fk_account = $obj->fk_account;
|
||||
$this->fk_type = $obj->fk_type;
|
||||
@ -275,7 +275,7 @@ class PaymentSalary extends CommonObject
|
||||
$this->dateep='';
|
||||
$this->note='';
|
||||
$this->fk_bank='';
|
||||
$this->fk_user_creat='';
|
||||
$this->fk_user_author='';
|
||||
$this->fk_user_modif='';
|
||||
}
|
||||
|
||||
@ -290,13 +290,14 @@ class PaymentSalary extends CommonObject
|
||||
global $conf,$langs;
|
||||
|
||||
$error=0;
|
||||
$now=dol_now();
|
||||
|
||||
// Clean parameters
|
||||
$this->amount=price2num(trim($this->amount));
|
||||
$this->label=trim($this->label);
|
||||
$this->note=trim($this->note);
|
||||
$this->fk_bank=trim($this->fk_bank);
|
||||
$this->fk_user_creat=trim($this->fk_user_creat);
|
||||
$this->fk_user_author=trim($this->fk_user_author);
|
||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||
|
||||
// Check parameters
|
||||
@ -340,7 +341,8 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= ", label";
|
||||
$sql.= ", datesp";
|
||||
$sql.= ", dateep";
|
||||
$sql.= ", fk_user_creat";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", fk_bank";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") ";
|
||||
@ -357,6 +359,7 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= ", '".$this->db->idate($this->datesp)."'";
|
||||
$sql.= ", '".$this->db->idate($this->dateep)."'";
|
||||
$sql.= ", '".$user->id."'";
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", NULL";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
@ -511,4 +514,41 @@ class PaymentSalary extends CommonObject
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
*
|
||||
* @param int $id Id of record
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT ps.rowid, ps.datec, ps.fk_user_author';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'payment_salary as ps';
|
||||
$sql.= ' WHERE ps.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);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author)
|
||||
{
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -51,12 +51,10 @@ function salaries_prepare_head($object) {
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
/*
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
*/
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries', 'remove');
|
||||
|
||||
|
||||
@ -42,3 +42,6 @@ create table llx_overwrite_trans
|
||||
transvalue text
|
||||
)ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_payment_salary ADD COLUMN datec datetime after tms;
|
||||
ALTER TABLE llx_payment_salary CHANGE COLUMN fk_user_creat fk_user_author integer;
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ create table llx_payment_salary
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
datec datetime, -- Create date
|
||||
fk_user integer NOT NULL,
|
||||
datep date, -- date de paiement
|
||||
datev date, -- date de valeur (this field should not be here, only into bank tables)
|
||||
@ -33,6 +34,6 @@ create table llx_payment_salary
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
note text,
|
||||
fk_bank integer,
|
||||
fk_user_creat integer, -- utilisateur qui a cree l'info
|
||||
fk_user_author integer, -- utilisateur qui a cree l'info
|
||||
fk_user_modif integer -- utilisateur qui a modifié l'info
|
||||
)ENGINE=innodb;
|
||||
Loading…
Reference in New Issue
Block a user