diff --git a/htdocs/install/mysql/tables/llx_payment_salary.sql b/htdocs/install/mysql/tables/llx_payment_salary.sql index d6ad2ffcfed..308e70effc2 100644 --- a/htdocs/install/mysql/tables/llx_payment_salary.sql +++ b/htdocs/install/mysql/tables/llx_payment_salary.sql @@ -22,7 +22,7 @@ create table llx_payment_salary ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date - fk_user integer NOT NULL, + fk_user integer DEFAULT NULL, datep date, -- payment date datev date, -- value date (this field should not be here, only into bank tables) salary double(24,8), -- salary of user when payment was done @@ -37,5 +37,6 @@ create table llx_payment_salary note text, fk_bank integer, fk_user_author integer, -- user creating - fk_user_modif integer -- user making last change + fk_user_modif integer, -- user making last change + fk_salary integer )ENGINE=innodb; diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index f2631caaae0..09082ee3d86 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -780,13 +780,13 @@ if ($id) /* * Payments */ - $sql = "SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,"; + $sql = "SELECT p.rowid, p.num_payment as num_payment, p.datep as dp, p.amount,"; $sql .= " c.code as type_code,c.libelle as paiement_type,"; $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal'; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; $sql .= ", ".MAIN_DB_PREFIX."salary as salaire"; $sql .= " WHERE p.fk_salary = ".$id; $sql .= " AND p.fk_salary = salaire.rowid"; diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 0e2ba67675a..b7d533c1243 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -68,7 +68,7 @@ class PaymentSalary extends CommonObject /** * @var int ID */ - public $fk_typepaiement; + public $fk_typepayment; /** * @var string @@ -89,7 +89,7 @@ class PaymentSalary extends CommonObject /** * @var int ID */ - public $fk_user_creat; + public $fk_user_author; /** * @var int ID @@ -134,12 +134,12 @@ class PaymentSalary extends CommonObject // Clean parameters if (isset($this->fk_salary)) $this->fk_salary = (int) $this->fk_salary; if (isset($this->amount)) $this->amount = trim($this->amount); - if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement; + if (isset($this->fk_typepayment)) $this->fk_typepayment = (int) $this->fk_typepayment; if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note)) $this->note = trim($this->note); if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; - if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; + if (isset($this->fk_user_author)) $this->fk_user_author = (int) $this->fk_user_author; if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; $totalamount = 0; @@ -160,7 +160,7 @@ class PaymentSalary extends CommonObject if ($totalamount != 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_salary, datec, datep, amount,"; - $sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)"; + $sql .= " fk_typepayment, num_payment, note, fk_user_author, fk_bank)"; $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datepaye)."',"; $sql .= " ".$totalamount.","; @@ -241,15 +241,15 @@ class PaymentSalary extends CommonObject $sql .= " t.tms,"; $sql .= " t.datep,"; $sql .= " t.amount,"; - $sql .= " t.fk_typepaiement,"; - $sql .= " t.num_paiement as num_payment,"; + $sql .= " t.fk_typepayment,"; + $sql .= " t.num_payment as num_payment,"; $sql .= " t.note,"; $sql .= " t.fk_bank,"; - $sql .= " t.fk_user_creat,"; + $sql .= " t.fk_user_author,"; $sql .= " t.fk_user_modif,"; $sql .= " pt.code as type_code, pt.libelle as type_label,"; $sql .= ' b.fk_account'; - $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id"; + $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; $sql .= " WHERE t.rowid = ".$id; // TODO link on entity of tax; @@ -270,12 +270,12 @@ class PaymentSalary extends CommonObject $this->tms = $this->db->jdate($obj->tms); $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; - $this->fk_typepaiement = $obj->fk_typepaiement; + $this->fk_typepayment = $obj->fk_typepayment; $this->num_paiement = $obj->num_payment; $this->num_payment = $obj->num_payment; $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->type_code = $obj->type_code; @@ -312,12 +312,12 @@ class PaymentSalary extends CommonObject if (isset($this->fk_salary)) $this->fk_salary = (int) $this->fk_salary; if (isset($this->amount)) $this->amount = trim($this->amount); - if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement; + if (isset($this->fk_typepayment)) $this->fk_typepayment = (int) $this->fk_typepayment; if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note)) $this->note = trim($this->note); if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; - if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; + if (isset($this->fk_user_author)) $this->fk_user_author = (int) $this->fk_user_author; if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; @@ -333,11 +333,11 @@ class PaymentSalary extends CommonObject $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " datep=".(dol_strlen($this->datep) != 0 ? "'".$this->db->idate($this->datep)."'" : 'null').","; $sql .= " amount=".(isset($this->amount) ? $this->amount : "null").","; - $sql .= " fk_typepaiement=".(isset($this->fk_typepaiement) ? $this->fk_typepaiement : "null").","; - $sql .= " num_paiement=".(isset($this->num_paiement) ? "'".$this->db->escape($this->num_paiement)."'" : "null").","; + $sql .= " fk_typepayment=".(isset($this->fk_typepayment) ? $this->fk_typepayment : "null").","; + $sql .= " num_payment=".(isset($this->num_payment) ? "'".$this->db->escape($this->num_payment)."'" : "null").","; $sql .= " note=".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : "null").","; $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; - $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; + $sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->fk_user_author : "null").","; $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").""; @@ -491,12 +491,12 @@ class PaymentSalary extends CommonObject $this->tms = ''; $this->datep = ''; $this->amount = ''; - $this->fk_typepaiement = ''; + $this->fk_typepayment = ''; $this->num_payment = ''; $this->note_private = ''; $this->note_public = ''; $this->fk_bank = ''; - $this->fk_user_creat = ''; + $this->fk_user_author = ''; $this->fk_user_modif = ''; } diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index 4d022b6704b..0d3a5f94cc0 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -144,7 +144,7 @@ print '